Merge branch 'main' into aihubmix

Carlos Alexandro Becker created

Change summary

CRUSH.md                            | 27 +++++++++++---
internal/providers/configs/zai.json | 55 +++++++++++++++++++++++-------
2 files changed, 62 insertions(+), 20 deletions(-)

Detailed changes

CRUSH.md 🔗

@@ -2,14 +2,9 @@
 
 ## Build/Test Commands
 
-- `go build` - Build the main HTTP server
-- `go build ./cmd/openrouter` - Build OpenRouter config generator
-- `go build ./cmd/aihubmix` - Build AIHubMix config generator
+- `go run .` - Build and run the main HTTP server on :8080
+- `go run ./cmd/{provider-name}` - Build and run a CLI to update the `{provider-name}.json` file
 - `go test ./...` - Run all tests
-- `go test -run TestName ./pkg/...` - Run specific test
-- `go run main.go` - Start HTTP server on :8080
-- `go run ./cmd/openrouter/main.go` - Generate OpenRouter config
-- `go run ./cmd/aihubmix/main.go` - Generate AIHubMix config
 
 ## Code Style Guidelines
 
@@ -24,3 +19,21 @@
 - HTTP: Always set timeouts, use context, defer close response bodies
 - JSON: Use `json.MarshalIndent` for pretty output, validate unmarshaling
 - File permissions: Use 0o600 for sensitive config files
+
+## Adding more provider commands
+
+- Create the `./cmd/{provider-name}/main.go` file
+- Try to use the provider API to figure out the available models. If there's no
+  endpoint for listing the models, look for some sort of structured text format
+  (usually in the docs). If none of that exist, refuse to create the command,
+  and add it to the `MANUAL_UPDATES.md` file.
+- Add it to `.github/workflows/update.yml`
+
+## Updating providers manually
+
+### Zai
+
+For `zai`, we'll need to grab the model list and capabilities from `https://docs.z.ai/guides/overview/overview`.
+
+That 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`.
+

internal/providers/configs/zai.json 🔗

@@ -5,54 +5,83 @@
   "api_endpoint": "https://api.z.ai/api/coding/paas/v4",
   "type": "openai-compat",
   "default_large_model_id": "glm-4.7",
-  "default_small_model_id": "glm-4.5-air",
+  "default_small_model_id": "glm-4.7-flash",
   "models": [
     {
       "id": "glm-4.7",
       "name": "GLM-4.7",
-      "cost_per_1m_in": 0.6,
+      "cost_per_1m_in": 0.42,
       "cost_per_1m_out": 2.2,
       "cost_per_1m_in_cached": 0.11,
-      "cost_per_1m_out_cached": 0,
       "context_window": 204800,
-      "default_max_tokens": 131072,
+      "default_max_tokens": 102400,
+      "can_reason": true,
+      "supports_attachments": false
+    },
+    {
+      "id": "glm-4.7-flash",
+      "name": "GLM-4.7 Flash",
+      "cost_per_1m_in": 0.07,
+      "cost_per_1m_out": 0.4,
+      "cost_per_1m_in_cached": 0.01,
+      "context_window": 200000,
+      "default_max_tokens": 65550,
       "can_reason": true,
       "supports_attachments": false
     },
     {
       "id": "glm-4.6",
       "name": "GLM-4.6",
-      "cost_per_1m_in": 0.6,
-      "cost_per_1m_out": 2.2,
+      "cost_per_1m_in": 0.39,
+      "cost_per_1m_out": 1.9,
       "cost_per_1m_in_cached": 0.11,
-      "cost_per_1m_out_cached": 0,
       "context_window": 204800,
-      "default_max_tokens": 131072,
+      "default_max_tokens": 102400,
       "can_reason": true,
       "supports_attachments": false
     },
+    {
+      "id": "glm-4.6v",
+      "name": "GLM-4.6V",
+      "cost_per_1m_in": 0.3,
+      "cost_per_1m_out": 0.9,
+      "context_window": 131072,
+      "default_max_tokens": 65536,
+      "can_reason": true,
+      "supports_attachments": true
+    },
     {
       "id": "glm-4.5",
       "name": "GLM-4.5",
       "cost_per_1m_in": 0.6,
       "cost_per_1m_out": 2.2,
       "cost_per_1m_in_cached": 0.11,
-      "cost_per_1m_out_cached": 0,
       "context_window": 131072,
-      "default_max_tokens": 98304,
+      "default_max_tokens": 49152,
       "can_reason": true,
       "supports_attachments": false
     },
     {
       "id": "glm-4.5-air",
       "name": "GLM-4.5-Air",
-      "cost_per_1m_in": 0.2,
-      "cost_per_1m_out": 1.1,
+      "cost_per_1m_in": 0.13,
+      "cost_per_1m_out": 0.85,
       "cost_per_1m_in_cached": 0.03,
       "context_window": 131072,
-      "default_max_tokens": 98304,
+      "default_max_tokens": 49152,
       "can_reason": true,
       "supports_attachments": false
+    },
+    {
+      "id": "glm-4.5v",
+      "name": "GLM-4.5V",
+      "cost_per_1m_in": 0.6,
+      "cost_per_1m_out": 1.8,
+      "cost_per_1m_in_cached": 0.11,
+      "context_window": 65536,
+      "default_max_tokens": 8192,
+      "can_reason": true,
+      "supports_attachments": true
     }
   ]
 }