-
Notifications
You must be signed in to change notification settings - Fork 455
feat(providers): add Zhipu AI GLM provider (open.bigmodel.cn) #536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -785,6 +785,29 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [ | |
| modelReasoningEfforts: Object.fromEntries(ZAI_GLM_52_MODELS.map(id => [id, ZAI_GLM_52_REASONING_EFFORTS])), | ||
| preserveReasoningContentModels: ZAI_GLM_52_MODELS, | ||
| }, | ||
| // Zhipu AI (BigModel) — the domestic Chinese OpenAI-compatible endpoint. Same GLM family | ||
| // as `zai`, but the public pay-as-you-go host at open.bigmodel.cn instead of the z.ai | ||
| // coding-plan subscription. Live model discovery is enabled so newly published GLM ids | ||
| // surface automatically without a registry edit. Evidence: docs.bigmodel.cn/api-reference. | ||
| { | ||
| id: "glm", | ||
| label: "Zhipu AI — GLM", | ||
| baseUrl: "https://open.bigmodel.cn/api/paas/v4", | ||
|
Comment on lines
+793
to
+795
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This adds a user-selectable provider with a distinct endpoint and billing product, but the public provider catalog still documents only the Z.AI coding-plan endpoint and never explains the new AGENTS.md reference: AGENTS.md:L78-L79 Useful? React with 👍 / 👎. |
||
| adapter: "openai-chat", | ||
| authKind: "key", | ||
| dashboardUrl: "https://bigmodel.cn/console/usercenter/apikeys", | ||
| defaultModel: "glm-4.6", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new default model has neither a Useful? React with 👍 / 👎. |
||
| models: ["glm-4.6", "glm-4.5", "glm-4-plus", "glm-4-air", "glm-4-airx", "glm-4-flash", "glm-4-flashx", "glm-4-long", "glm-4v"], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| liveModels: true, | ||
| // GLM-4.6 exposes a binary thinking toggle: `thinking: {type: "enabled" | "disabled"}`. | ||
| // Evidence: docs.bigmodel.cn/cn/guide/models/text/glm-4.6, docs.z.ai/guides/capabilities/thinking-mode. | ||
| // Reuses the shared THINKING_TOGGLE_EFFORTS / THINKING_TOGGLE_MAP constants. | ||
| thinkingToggleModels: ["glm-4.6"], | ||
| modelReasoningEfforts: { "glm-4.6": THINKING_TOGGLE_EFFORTS }, | ||
| modelReasoningEffortMap: { "glm-4.6": THINKING_TOGGLE_MAP }, | ||
| preserveReasoningContentModels: ["glm-4.6"], | ||
|
Comment on lines
+805
to
+808
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The test change only adds AGENTS.md reference: AGENTS.md:L75-L77 Useful? React with 👍 / 👎. |
||
| note: "Zhipu AI / ChatGLM OpenAI-compatible endpoint (open.bigmodel.cn)", | ||
| }, | ||
| { id: "nanogpt", label: "NanoGPT", baseUrl: "https://nano-gpt.com/api/v1", adapter: "openai-chat", authKind: "key", dashboardUrl: "https://nano-gpt.com/api" }, | ||
| { id: "synthetic", label: "Synthetic", baseUrl: "https://api.synthetic.new/openai/v1", adapter: "openai-chat", authKind: "key", dashboardUrl: "https://synthetic.new" }, | ||
| // SiliconFlow publishes an OpenAI-compatible chat endpoint and a dynamic model catalog. Do not | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ function nativeTemplate(): Record<string, unknown> { | |
| const EXPECTED_KEY_PROVIDER_IDS = [ | ||
| "anthropic-apikey", "openai-apikey", "umans", "opencode-go", "neuralwatt", "openrouter", "orcarouter", "bizrouter", "groq", "google", "google-vertex", "azure-openai", | ||
| "deepseek", "cerebras", "together", "fireworks", "firepass", "moonshot", | ||
| "huggingface", "nvidia", "venice", "zai", "nanogpt", "synthetic", "siliconflow", "qwen-cloud", "tencent-coding-plan", | ||
| "huggingface", "nvidia", "venice", "zai", "glm", "nanogpt", "synthetic", "siliconflow", "qwen-cloud", "tencent-coding-plan", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win Cover the GLM provider contract, not only its ID. This test only proves that As per path instructions, a behavior change in 🤖 Prompt for AI AgentsSource: Path instructions |
||
| "qianfan", "alibaba", "alibaba-token-plan", "alibaba-token-plan-intl", "parallel", "zenmux", "litellm", "ollama-cloud", "mistral", | ||
| "minimax", "minimax-cn", "kimi-code", "opencode-zen", "vercel-ai-gateway", | ||
| "opencode-free", "xiaomi", "kilo", "mimo-free", "cloudflare-ai-gateway", "cloudflare-workers-ai", "gitlab-duo", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glmprovider nameWhen upgrading an existing config with a user-defined provider named
glm,routedProviderConfignow recognizes this registry id and, becauseallowBaseUrlOverrideis not enabled, silently replaces the saved endpoint withopen.bigmodel.cn. The repository already assignsglminFREE_PROVIDER_DIRECTORYto Z.AI athttps://api.z.ai/api/coding/paas/v4, so a config created from that identity will suddenly send requests and its API key to a different host. Use an unused id such asglm-cn/zhipu-bigmodel, or add an explicit migration that does not retarget existing custom entries.AGENTS.md reference: AGENTS.md:L65-L70
Useful? React with 👍 / 👎.