Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/providers/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid commandeering the existing glm provider name

When upgrading an existing config with a user-defined provider named glm, routedProviderConfig now recognizes this registry id and, because allowBaseUrlOverride is not enabled, silently replaces the saved endpoint with open.bigmodel.cn. The repository already assigns glm in FREE_PROVIDER_DIRECTORY to Z.AI at https://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 as glm-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 👍 / 👎.

label: "Zhipu AI — GLM",
baseUrl: "https://open.bigmodel.cn/api/paas/v4",
Comment on lines +793 to +795

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the domestic BigModel preset

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 glm route. Update the English provider guide and its translated tables so users can distinguish the domestic pay-as-you-go preset from zai and configure the intended credential and route.

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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Declare GLM-4.6's full context window

The new default model has neither a modelContextWindows entry nor a metadata bundle alias, so whenever live discovery fails or returns the ordinary OpenAI model-list shape without context_length, catalog normalization advertises only the generic 128,000-token fallback. The repository's generated GLM metadata records glm-4.6 at 204,800 tokens, meaning Codex compacts or truncates roughly 76,800 tokens early for this preset. Add the explicit context window or connect this provider to the appropriate GLM metadata bundle.

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"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Advertise image input for GLM-4V

When glm-4v is selected, the catalog publishes it as text-only because this provider supplies no modelInputModalities entry and the generic catalog fallback is ["text"]; live /models parsing does not infer image capability either. Codex therefore blocks image attachments before they can reach this vision model. Add explicit glm-4v: ["text", "image"] capability metadata.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add a focused GLM request-shaping regression test

The test change only adds glm to the expected provider-id list, so it never exercises the newly declared thinking-toggle or reasoning-history behavior. Add a focused test that routes glm/glm-4.6 and verifies effort mapping produces thinking: { type: "enabled" | "disabled" } rather than reasoning_effort, plus the intended reasoning_content replay; otherwise the central behavior introduced here can regress while the parity test remains green.

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
Expand Down
2 changes: 1 addition & 1 deletion tests/provider-registry-parity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 "glm" appears in the expected key-provider list. It will not catch an incorrect baseUrl, adapter/auth configuration, default model, liveModels, or thinking mappings in src/providers/registry.ts Lines 795-808. Add a focused assertion that retrieves the glm entry and verifies those fields.

As per path instructions, a behavior change in src/ should come with a focused regression test near the existing subsystem tests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/provider-registry-parity.test.ts` at line 35, Extend the provider
parity test beyond checking that "glm" is listed: retrieve the GLM entry from
the expected provider registry and assert its baseUrl, adapter/auth
configuration, default model, liveModels, and thinking mappings match the
contract defined in the GLM registry entry. Keep the assertions focused near the
existing provider-list coverage.

Source: 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",
Expand Down
Loading