Summary
The zai provider in @mariozechner/pi-ai is configured with baseUrl: "https://api.z.ai/api/coding/paas/v4" — Z.ai's GLM Coding Plan endpoint. Per Z.ai's official usage policy, the Coding Plan is "strictly limited to use within officially supported tools and products" and explicitly forbids "SDK-based access or other third-party integrations." Pi is not on the supported tools list.
Several r/ZaiGLM posts warns users that hitting …/coding/paas/v4/chat/completions directly via SDK or curl may trigger risk-control measures, including throttling, account suspension, or permanent ban after three violations.
Evidence
1. Pi-ai routes all zai/* models through the Coding Plan endpoint
pi-ai@0.73.0 dist/models.generated.js:
"zai": {
"glm-4.7": {
baseUrl: "https://api.z.ai/api/coding/paas/v4",
compat: { supportsDeveloperRole: false, thinkingFormat: "zai" },
// ...
},
// same baseUrl for glm-4.5, 4.5-air, 4.5v, 4.6, 4.6v, 5, 5-turbo, 5.1, 5v-turbo
}
The OpenAI SDK appends /chat/completions, so the wire request hits https://api.z.ai/api/coding/paas/v4/chat/completions — exactly the URL flagged in the Reddit post.
2. Captured wire request
I captured a real outbound request from complete() against a local server, using the unmodified ZAI provider config (only host rewritten to localhost):
POST /api/coding/paas/v4/chat/completions
user-agent: OpenAI/JS 6.26.0
x-stainless-lang: js
x-stainless-package-version: 6.26.0
x-stainless-os: Linux
x-stainless-runtime: node
authorization: Bearer <token>
content-type: application/json
No identifying tool header. Indistinguishable from stock openai SDK usage. To Z.ai's risk control system this is exactly the "SDK-based access" their policy describes.
3. Pi-ai already masquerades for comparable providers
Same file, other providers:
// github-copilot:
headers: {
"User-Agent": "GitHubCopilotChat/0.35.0",
"Editor-Version": "vscode/1.107.0",
"Copilot-Integration-Id": "vscode-chat"
}
// kimi-coding:
headers: { "User-Agent": "KimiCLI/1.5" }
// zai: <no headers field set>
4. Z.ai's policy, verbatim
From https://docs.z.ai/devpack/usage-policy:
"The GLM Coding Plan is strictly limited to use within officially supported tools and products. … If the system detects usage through unauthorized or unsupported tools (such as SDK-based access or other third-party integrations), some subscription benefits may be restricted. … Violating the Usage Rules three or more times will result in an account ban."
Officially supported tools (https://docs.z.ai/devpack/tool/others): Claude Code, Cursor, Cline, Roo Code, Kilo Code, OpenCode, Crush, Goose, TRAE, Qoder, Factory Droid, Eigent, Gemini CLI, Grok CLI, plus best-effort tier (OpenClaw, Hermes Agent, SillyTavern, n8n). Pi is not listed; OpenClaw is, but pi-ai's wire traffic doesn't identify as OpenClaw either.
Impact
- Coding Plan subscribers using Pi with any
zai/* model risk throttling or account bans.
- Affects pi directly and any extension that routes to a user-selected model (e.g.
pi-vision-proxy when a ZAI vision model is picked, pi-zai-provider).
- Pay-as-you-go (general API) users are also misrouted: per Z.ai's docs they should hit
https://api.z.ai/api/paas/v4, not the coding endpoint.
Suggested fixes
- Split the provider. Add a separate
zai-general (or rename current to zai-coding) that uses https://api.z.ai/api/paas/v4. Default end-user setups to the general endpoint; keep the coding endpoint opt-in?
- Apply for whitelisting. Several listed tools (OpenCode, Crush, Goose) are similar in scope to Pi, so adding Pi looks plausible. If approved, add canonical identifying headers in
models.generated.js for the zai provider.
References
Summary
The
zaiprovider in@mariozechner/pi-aiis configured withbaseUrl: "https://api.z.ai/api/coding/paas/v4"— Z.ai's GLM Coding Plan endpoint. Per Z.ai's official usage policy, the Coding Plan is "strictly limited to use within officially supported tools and products" and explicitly forbids "SDK-based access or other third-party integrations." Pi is not on the supported tools list.Several r/ZaiGLM posts warns users that hitting
…/coding/paas/v4/chat/completionsdirectly via SDK or curl may trigger risk-control measures, including throttling, account suspension, or permanent ban after three violations.Evidence
1. Pi-ai routes all
zai/*models through the Coding Plan endpointpi-ai@0.73.0dist/models.generated.js:The OpenAI SDK appends
/chat/completions, so the wire request hitshttps://api.z.ai/api/coding/paas/v4/chat/completions— exactly the URL flagged in the Reddit post.2. Captured wire request
I captured a real outbound request from
complete()against a local server, using the unmodified ZAI provider config (only host rewritten to localhost):No identifying tool header. Indistinguishable from stock
openaiSDK usage. To Z.ai's risk control system this is exactly the "SDK-based access" their policy describes.3. Pi-ai already masquerades for comparable providers
Same file, other providers:
4. Z.ai's policy, verbatim
From https://docs.z.ai/devpack/usage-policy:
Officially supported tools (https://docs.z.ai/devpack/tool/others): Claude Code, Cursor, Cline, Roo Code, Kilo Code, OpenCode, Crush, Goose, TRAE, Qoder, Factory Droid, Eigent, Gemini CLI, Grok CLI, plus best-effort tier (OpenClaw, Hermes Agent, SillyTavern, n8n). Pi is not listed; OpenClaw is, but pi-ai's wire traffic doesn't identify as OpenClaw either.
Impact
zai/*model risk throttling or account bans.pi-vision-proxywhen a ZAI vision model is picked,pi-zai-provider).https://api.z.ai/api/paas/v4, not the coding endpoint.Suggested fixes
zai-general(or rename current tozai-coding) that useshttps://api.z.ai/api/paas/v4. Default end-user setups to the general endpoint; keep the coding endpoint opt-in?models.generated.jsfor thezaiprovider.References