graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
0151. Z.AI Coding Plan login is a Graff-named API key on the coding host
Status: accepted 2026-09-21
Context
Z.AI pay-go keys hit https://api.z.ai/api/paas/v4. A GLM Coding Plan key has
to hit /api/coding/paas/v4, which until now required ZAI_CODING=1 or
GRAFF_ZAI_URL after pasting a key.
zai-org/ZCode publishes a CLI OAuth broker
at https://zcode.z.ai/api/v1/oauth/cli/{init,poll} that turns a browser login
into a Z.AI OAuth access token, then provisions a business API key.
Decision
graff login zai(aliasesglm,z.ai) is aProviderSpec.login = .zai_clisub_login, same class as Kimi Code and SuperGrok.- The CLI broker is public, like the Codex and Kimi clients graff already uses.
User-Agent stays
graff/<version>. The provisioned key is namedgraff-api-key, notzcode-api-key, so a ZCode login and a Graff login do not share or revoke each other. - Chat uses the provisioned
apiKey.secretKeyon/api/coding/paas/v4. A successful login persists that routing;ZAI_CODING=1is no longer required.GRAFF_ZAI_URLstill wins. - Metered
ZAI_API_KEYremains the pay-go seat and is parked when a plan login exists (credential_failover.preferPlan).
Cost
The broker can lock to the ZCode app. Fallback stays ZAI_API_KEY plus
ZAI_CODING=1. China BigModel (zcode login bigmodel) is not this record.