You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Bug]: Interactive provider onboarding presets the Z.AI/Zhipu general API-plan endpoint, so Coding Plan keys fail the connectivity test and nothing is saved #259
Adding Z.AI / GLM-5.3 through the interactive provider flow fails with a valid key, and no provider is written to config.yaml. The onboarding preselects the Z.AI general API plan endpoint (https://api.z.ai/api/paas/v4), but a Coding Plan key only works against the coding endpoint (https://api.z.ai/api/coding/paas/v4). The connectivity test fails, and because the flow tests before persisting, nothing is saved.
I had to hand-write the custom_provider block in config.yaml to get GLM-5.3 working.
Root cause
The provider-preset catalog pins a region-specific preferred provider list, but it uses the general API-plan provider ids rather than the coding-plan ones:
models.dev (the source of these presets) exposes four relevant providers, and mcode's cached snapshot contains all four:
provider id
base URL
plan
region
zai
https://api.z.ai/api/paas/v4
general API
international
zai-coding-plan
https://api.z.ai/api/coding/paas/v4
Coding Plan
international
zhipuai
https://open.bigmodel.cn/api/paas/v4
general API
China
zhipuai-coding-plan
https://open.bigmodel.cn/api/coding/paas/v4
Coding Plan
China
REGION_PINNED_PROVIDER_IDS only pins zai (international) / zhipuai (China). Pinned ids are sorted to the front, so the top entry in the picker is "Z.AI" → the general endpoint. The coding-plan presets are present but buried below it, and the labels ("Z.AI" vs "Z.AI Coding Plan") do not make the endpoint difference obvious.
Region detection itself works (cn → bigmodel, en → api.z.ai); the problem is that it selects the general plan, not the coding plan.
Reproduction
Outside China, with a Z.AI Coding Plan key, open /provider (or run mcode provider) and pick the top Z.AI preset.
Enter the (valid) Coding Plan key and model glm-5.3.
The connectivity test fails and no custom_provider entry is written to ~/.minimax/config.yaml.
Verified with curl using the same key:
POST https://api.z.ai/api/paas/v4/chat/completions (general) → 429
{"error":{"code":"1113","message":"Insufficient balance or no resource package. Please recharge."}}
POST https://api.z.ai/api/coding/paas/v4/chat/completions (coding) → 200
So the test fails purely because it targets the wrong plan's endpoint, not because the key is wrong.
Expected behavior
Include the coding-plan presets in the region-pinned lists, e.g.:
and label them clearly ("Z.AI Coding Plan" vs "Z.AI API").
Better: auto-detect. When the connectivity test against the general endpoint returns 401/429/"insufficient balance" for a zai/zhipuai key, retry once against the matching coding endpoint and save that on success. Both endpoints use the same bearer-token shape, so this is cheap and removes the guesswork for the common case (coding plans are the plan most users buy).
models.dev's env var for these providers is ZHIPU_API_KEY, not ZAI_API_KEY, which is another onboarding gotcha for Z.AI users.
Inconsistency worth reconciling: mcode's bundled model catalog maps the zai provider id to the coding URL (https://api.z.ai/api/coding/paas/v4) and zai-coding-cn to the bigmodel coding URL, while the BYOK provider-preset flow maps zai to the general URL. The same id means different endpoints depending on the surface.
GLM-5.3 is present in all four models.dev presets, so this is purely an endpoint/selection problem, not a missing-model problem.
Environment
@minimax-ai/code) 0.5.0, npm install, Linux, Node v24.18.0Summary
Adding Z.AI / GLM-5.3 through the interactive provider flow fails with a valid key, and no provider is written to
config.yaml. The onboarding preselects the Z.AI general API plan endpoint (https://api.z.ai/api/paas/v4), but a Coding Plan key only works against the coding endpoint (https://api.z.ai/api/coding/paas/v4). The connectivity test fails, and because the flow tests before persisting, nothing is saved.I had to hand-write the
custom_providerblock inconfig.yamlto get GLM-5.3 working.Root cause
The provider-preset catalog pins a region-specific preferred provider list, but it uses the general API-plan provider ids rather than the coding-plan ones:
packages/local-runtime-v2/src/service/model-system/catalog/provider-presets/provider-presets.service.ts:21-28models.dev (the source of these presets) exposes four relevant providers, and mcode's cached snapshot contains all four:
zaihttps://api.z.ai/api/paas/v4zai-coding-planhttps://api.z.ai/api/coding/paas/v4zhipuaihttps://open.bigmodel.cn/api/paas/v4zhipuai-coding-planhttps://open.bigmodel.cn/api/coding/paas/v4REGION_PINNED_PROVIDER_IDSonly pinszai(international) /zhipuai(China). Pinned ids are sorted to the front, so the top entry in the picker is "Z.AI" → the general endpoint. The coding-plan presets are present but buried below it, and the labels ("Z.AI" vs "Z.AI Coding Plan") do not make the endpoint difference obvious.Region detection itself works (
cn→ bigmodel,en→ api.z.ai); the problem is that it selects the general plan, not the coding plan.Reproduction
/provider(or runmcode provider) and pick the top Z.AI preset.glm-5.3.custom_providerentry is written to~/.minimax/config.yaml.Verified with curl using the same key:
POST https://api.z.ai/api/paas/v4/chat/completions(general) → 429{"error":{"code":"1113","message":"Insufficient balance or no resource package. Please recharge."}}POST https://api.z.ai/api/coding/paas/v4/chat/completions(coding) → 200So the test fails purely because it targets the wrong plan's endpoint, not because the key is wrong.
Expected behavior
zai/zhipuaikey, retry once against the matching coding endpoint and save that on success. Both endpoints use the same bearer-token shape, so this is cheap and removes the guesswork for the common case (coding plans are the plan most users buy).Notes
ZHIPU_API_KEY, notZAI_API_KEY, which is another onboarding gotcha for Z.AI users.zaiprovider id to the coding URL (https://api.z.ai/api/coding/paas/v4) andzai-coding-cnto the bigmodel coding URL, while the BYOK provider-preset flow mapszaito the general URL. The same id means different endpoints depending on the surface.