How Z.AI works
Z.AI (developed by Zhipu AI) serves the GLM family of models. It’s one of the few major providers offering a flat-rate subscription for API access: the GLM Coding Plan bundles model usage at a fixed monthly price, with rate limits applied over 5-hour and weekly windows instead of per-token billing. For higher-volume or variable workloads, Z.AI also offers pay-per-token access to the same models on its standard Developer API. Both paths expose an OpenAI-compatible endpoint, so Kodus can talk to them via the OpenAI-compatible provider. Kodus also has a dedicated Z.ai provider, which connects over Z.AI’s Anthropic-compatible endpoint (https://api.z.ai/api/anthropic).
Plans at a glance
Pricing and quotas change regularly. Always confirm current numbers at z.ai/subscribe and docs.z.ai before choosing a tier.
GLM Coding Plan (subscription)
- Quotas reset on a rolling 5-hour window and a weekly window — plan around the ceiling, not a monthly cap.
- Coverage includes GLM-5.1, GLM-5-Turbo, GLM-5, GLM-4.5, and GLM-4.5-Air.
- Coding Plan endpoints:
https://api.z.ai/api/anthropic(Anthropic-compatible — the one the Z.ai provider in Kodus uses) andhttps://api.z.ai/api/coding/paas/v4(OpenAI-compatible). The standard/api/paas/v4/endpoint does not draw from the Coding Plan.
Pay-per-token Developer API
Standard endpoint:
https://api.z.ai/api/paas/v4/ (OpenAI-compatible).
Creating an API Key
- Coding Plan subscriber
- Developer API (pay-per-token)
- Sign in at z.ai.
- Purchase a GLM Coding Plan tier at z.ai/subscribe.
- Open the key management page for your subscription and create a Coding Plan key.
- Copy the key — you will not be able to see it again.
Coding Plan keys are tied to the Coding Plan endpoints (
/api/anthropic and /api/coding/paas/v4). They will return 401 if sent against the standard /api/paas/v4/ endpoint.Configure Z.AI in Kodus
The primary flow is the AI providers page on Kodus Cloud. Self-hosted users who prefer fixing the provider at the process level can use environment variables instead.Option 1 — Z.ai provider on Kodus Cloud (recommended)
1
Open AI providers and pick Z.ai
In the sidebar, open AI providers (app.kodus.io/byok). On the Providers tab, click the Z.ai tile (under Connect your first provider, or Add another provider if you already connected one).
2
Paste your API key and enter the model
Paste your Z.AI key in the API key card, then type the model ID (e.g.
glm-5.1) in Model. Kodus fills in the https://api.z.ai/api/anthropic endpoint for you — the Anthropic-compatible endpoint Z.AI documents for the GLM Coding Plan — so this tile has no plan selector and no base URL field. To use a specific OpenAI-compatible endpoint instead, use Option 2 below.3
Set concurrency (Coding Plan)
Kodus does not pre-fill concurrency. On Coding Plan Lite/Pro, open Advanced (optional) and set Max concurrent requests to
1; raise it up to 30 if you’re on Max.4
Test & save
Click Test & save. Kodus tests the connection and saves the config on success. 401 means the key doesn’t match the endpoint.
Tuning reasoning (optional)
Thinking / Reasoning is under Advanced (optional). For GLM, any level other than Off emitsthinking: { type: "enabled" }, which is fine for most workloads. Two cases to override:
-
Force a specific token budget — switch Thinking / Reasoning to Custom and paste:
-
Disable thinking — for fastest/cheapest reviews on small PRs:
No namespace wrapping needed — Kodus wraps the options under the active provider’s namespace before sending. See the main BYOK doc → Custom JSON override for details.
Tuning concurrency
- Coding Plan Lite / Pro: set Max concurrent requests to
1. Going higher returns429 Too much concurrency. - Coding Plan Max: raise to
5first, up to30if you don’t see 429s. Max tier allows up to 30 concurrent. - Developer API: start empty (no cap). Drop to
5if you see rate-limit errors, then tune up.
On the Routing tab, set GLM 5.1 as Model for all tasks and an OpenAI or Anthropic model as Fallback (optional) so that reviews keep running when your Coding Plan 5-hour window is exhausted. Kodus fails over automatically.
Option 2 — OpenAI-compatible endpoint
To connect through one of Z.AI’s OpenAI-compatible endpoints, open AI providers, pick OpenAI-compatible under Custom on the Providers tab, and fill:Option 3 — Self-hosted (environment variables)
If you run Kodus in Fixed Mode (single global provider, no per-org BYOK), configure Z.AI in the.env of your API + worker containers:
This path is only needed for self-hosted Kodus installs that deliberately disable BYOK. If BYOK is enabled on your self-hosted instance, prefer Option 1 — the AI providers page works the same as on Cloud.
.env, then verify the integration:
Choosing between the Coding Plan and pay-per-token
- Pick the Coding Plan when you have a predictable team of reviewers and want a flat monthly cost. The 5-hour and weekly quotas translate to roughly 15–30× the subscription fee in equivalent API spend.
- Pick pay-per-token when your traffic is bursty, when you need occasional access to the largest context windows, or when you want cost to scale linearly with PR volume.
- Pair them: in Routing, use the Coding Plan as Model for all tasks and a Developer API key (or an entirely different provider) as Fallback (optional) to cover bursts that exhaust your subscription window.
Troubleshooting
401 after Test — key doesn't match endpoint
401 after Test — key doesn't match endpoint
- Coding Plan keys work on
/api/anthropicand/api/coding/paas/v4, not on/api/paas/v4/. Developer API keys use/api/paas/v4/. - The Z.ai tile always uses
https://api.z.ai/api/anthropic. If your key is only valid on another endpoint, connect it through OpenAI-compatible with that Base URL. - With OpenAI-compatible, confirm the Base URL matches the key origin.
'Too much concurrency' at review time
'Too much concurrency' at review time
- Lite and Pro Coding Plan tiers typically allow only 1 concurrent request. Set Max concurrent requests to
1; raise it only on Max. - Lower Max concurrent requests in Advanced settings if you’re still hitting 429s.
Quota exhausted on the Coding Plan
Quota exhausted on the Coding Plan
- Quotas are enforced on a 5-hour rolling window and a weekly window. Hitting one of them returns HTTP 429.
- Check remaining quota in the Z.AI console.
- Options: wait for the next window, upgrade to a higher tier, or have a Developer API key configured as the Fallback (optional) model in Routing to cover the gap.
Model not found
Model not found
- Verify the model ID matches Z.AI’s catalog (
glm-5.1,glm-5-turbo,glm-5,glm-4.5,glm-4.5-air). - The Coding Plan currently covers only the GLM family — non-GLM model names will be rejected.
Connection errors (timeout, DNS)
Connection errors (timeout, DNS)
- Confirm your server can reach
api.z.ai. - Check the API and worker logs for the exact upstream error.
- If you are in a region with restricted outbound traffic, route requests through a reverse proxy your infra allows.