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- Always format code with `gofumpt`
23
24## Adding more provider commands
25
26- Create the `./cmd/{provider-name}/main.go` file
27- Try to use the provider API to figure out the available models. If there's no
28 endpoint for listing the models, look for some sort of structured text format
29 (usually in the docs). If none of that exist, refuse to create the command,
30 and add it to the `MANUAL_UPDATES.md` file.
31- Add it to `.github/workflows/update.yml`
32
33## Updating providers manually
34
35### Zai
36
37For `zai`, we'll need to grab the model list and capabilities from `https://docs.z.ai/guides/overview/overview`.
38
39That 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`.