Repository navigation
Description
What happened?
The CLI bundled with the ZCode desktop app (v0.16.5, node …/ZCode.app/Contents/Resources/glm/zcode.cjs) cannot authenticate headless mode (zcode -p) against a paid GLM Coding Plan (team plan, provider builtin:zai-coding-plan).
What we verified step by step on macOS (ZCode desktop 3.11.2):
zcode login(browser OAuth, same account as the desktop app) succeeds and writesprovider["builtin:zai-coding-plan"]+model.main = "builtin:zai-coding-plan/GLM-5.3"to~/.zcode/cli/config.json.- Any
zcode -p "…"run then fails with HTTP 429 / business code 1113 ("Insufficient balance or no resource package. Please recharge.") — the exchanged key is a public PAYG key; the Coding Plan subscription is not attached to it. Example request id:2026090603152417b590b052694c30. - The desktop app itself works at the same time, same account, same provider id, logging
model.networkrequests tohttps://api.z.ai/api/anthropicwithbuiltin:zai-coding-plan/GLM-5.3. So the working credential never leaves the app's memory (passed to the runtime over the protocol, not env/config). - Direct probes against the plan gateway:
https://zcode.z.ai/api/v1/zcode-plan/anthropic/v1/messageswith the official ZCode JWT (zcodejwttokenfrom the shared credential store) asAuthorization: Bearer …→ HTTP 400,{"code":3007,"msg":"captcha verify failed"}; asx-api-key→ 401.https://api.z.ai/api/anthropic/v1/messageswith every persisted credential (exchanged key, OAuth access token, JWT) → 1113 or 401.
- The interactive
tuisubcommand is also unusable in this distribution:Cannot find package '@zcode/tui'(the package is neither bundled next tozcode.cjsnor published on npm), so the/login zai-coding-planflow documented in the bundle cannot be reached from a terminal. Running/login zai-coding-planvia-panswers "not available in this client".
Related community report describing the same key-minting behavior in a third-party client: can1357/oh-my-pi#8802.
Question / expected behavior: is there a supported way for the standalone CLI (headless -p) to consume a paid Coding Plan? Expected: zcode login on a Coding-Plan account should produce credentials that actually serve plan traffic (either a plan-attached key on api.z.ai or the official JWT against zcode.z.ai/api/v1/zcode-plan/anthropic), instead of a PAYG key that returns 1113.
Relevant log output
$ zcode -p "test" --cwd ~/Herd/zalvadora
ProviderBusinessError: [1113][Insufficient balance or no resource package. Please recharge.][2026090603152417b590b052694c30]
code: 'PROVIDER_BUSINESS_ERROR',
providerCode: '1113',
providerId: 'builtin:zai-coding-plan',
providerKind: 'anthropic',
responseStatus: 429
$ zcode # TUI
Error: Cannot find package '@zcode/tui' imported from /Applications/ZCode.app/Contents/Resources/glm/zcode.cjs
Environment: macOS 15 (darwin 25.6.0 arm64), ZCode desktop 3.11.2, bundled CLI 0.16.5, node v24.15.0, Z.ai Coding Plan (team plan) on the logged-in account.
No API keys or tokens are included in this report.
Activity
Motoharu-Kataoka commentedon Oct 24, 2026
Same wall here, on a different plan tier and error signature — adding repro data.
Environment
resources/glm/zcode.cjs, run with node v22.23.4)Reproduction
zcode login zai --no-browser→ OAuth succeeds, writesdefaultModelSelection: account:zai-individual-coding-plan/GLM-5.3into~/.zcode/v2/provider_config.json.zcode -p "..." --json --mode yolo→ model selection now passes, but turn execution fails:POST https://api.z.ai/api/auth/z/loginwith the OAuth access token, and the endpoint answers:{"code":500,"msg":"Z.ai user information is invalid","data":null,"success":false}The same token works for desktop sessions because the desktop host injects the coding-plan key into CLI child processes via env instead of minting one — so the plan credential never reaches the standalone CLI.
Notes
--mode planand--mode guardedfail identically (it is authentication, not tool policy).providerRulesinprovider_config.jsonnever reach the standalone registry; the builtin provider config is integrity-protected by the signed remote-refresh mechanism; writingaccount-provider:…:api-keyslots into the shared credential store does not change the mint flow.Would be great to know if there is (or is planned) a supported path for headless CLI usage of plan subscriptions — either fixing the standalone mint flow, exposing a coding-plan API key usable by the CLI, or letting the desktop act as a credential host for headless child sessions.