1# Catwalk - AI Provider Database
2
3## Build/Test Commands
4
5- `go run .` - Build and run the main HTTP server on :8080
6- `go run ./cmd/{provider-name}` - Build and run a CLI to update the `{provider-name}.json` file
7- `go test ./...` - Run all tests
8
9## Code Style Guidelines
10
11- Package comments: Start with "Package name provides/represents..."
12- Imports: Standard library first, then third-party, then local packages
13- Error handling: Use `fmt.Errorf("message: %w", err)` for wrapping
14- Struct tags: Use json tags with omitempty for optional fields
15- Constants: Group related constants with descriptive comments
16- Types: Use custom types for IDs (e.g., `InferenceProvider`, `Type`)
17- Naming: Use camelCase for unexported, PascalCase for exported
18- Comments: Use `//nolint:directive` for linter exceptions
19- HTTP: Always set timeouts, use context, defer close response bodies
20- JSON: Use `json.MarshalIndent` for pretty output, validate unmarshaling
21- File permissions: Use 0o600 for sensitive config files
22
23## Adding more provider commands
24
25- Create the `./cmd/{provider-name}/main.go` file
26- Try to use the provider API to figure out the available models. If there's no
27 endpoint for listing the models, look for some sort of structured text format
28 (usually in the docs). If none of that exist, refuse to create the command,
29 and add it to the `MANUAL_UPDATES.md` file.
30- Add it to `.github/workflows/update.yml`
31
32## Updating providers manually
33
34### Zai
35
36For `zai`, we'll need to grab the model list and capabilities from `https://docs.z.ai/guides/overview/overview`.
37
38That page does not contain the exact `context_window` and `default_max_tokens` though. We can grab the exact value from `./internal/providers/configs/openrouter.json`.
39