zai provider with a Z.AI API key.
GLM models
GLM is a model family, not a separate provider. In OpenClaw, GLM models use refs such aszai/glm-5.2: provider zai, model id glm-5.2.
Getting started
Install the provider plugin first:- Auto-detect endpoint
- Explicit regional endpoint
Best for: most users. OpenClaw probes supported Z.AI endpoints with your API key and applies the correct base URL automatically.
1
Run onboarding
2
Verify the model is listed
Endpoints
zai-api-key auto-detects one of these four by probing your key against each
endpoint’s chat-completions API, checking general endpoints (zai-global,
then zai-cn) before Coding Plan endpoints (zai-coding-global, then
zai-coding-cn), and stopping at the first endpoint that accepts a request.
Use an explicit --auth-choice to force a Coding Plan endpoint if your key
works on both.
Rate limits and overloads
Z.AI documents the Coding Plan and general-purpose agent tools as capacity managed services. In Z.AI’s own docs:- General-purpose agent tools, including OpenClaw, are served on a best-effort basis. During high inference load, typically around 2-6 PM Singapore time, some requests may face temporary rate limits.
- Coding Plan rate and concurrency limits are tied to the plan tier and can be adjusted dynamically based on resource availability. Off-peak hours may have higher concurrency.
- API error code
1302means “Rate limit reached for requests”. API error code1305means “The service may be temporarily overloaded, please try again later”.
429 or 1305 response during a busy period, wait and
retry the request. If failures are repeatable outside peak periods, or only
occur for one endpoint, model, or request shape, check the configured endpoint
and model first:
https://api.z.ai/api/coding/paas/v4; general API keys should use a general API
endpoint such as https://api.z.ai/api/paas/v4. Persistent failures with the
same key and endpoint can indicate a provider-side rejection or plan limitation,
not ordinary peak-load throttling.
Config example
Built-in catalog
Thezai provider plugin ships its catalog in the plugin manifest, so read-only
listing can show known GLM rows without loading provider runtime:
Coding Plan setup defaults to
zai/glm-5.2; general API setup keeps
zai/glm-5.1. On the Coding Plan endpoints, auto-detection falls back to
glm-5.1 and then glm-4.7 when the key/plan does not expose GLM-5.2. GLM
versions and availability can change; run openclaw models list --all --provider zai
to see the catalog known to your installed version.Thinking levels
- GLM-5.2
- Other GLM models
Full range:
off, low, high, max (default off). OpenClaw maps
low and high to Z.AI’s high reasoning effort, and max to Z.AI’s
max effort, via reasoning_effort on the request payload.off avoids responses that spend the output budget on
reasoning_content before visible text.
Advanced configuration
Forward-resolving unknown GLM-5 models
Forward-resolving unknown GLM-5 models
Unknown
glm-5* ids still forward-resolve on the provider path by
synthesizing provider-owned metadata from the glm-4.7 template when the id
matches the current GLM-5 family shape.Tool-call streaming
Tool-call streaming
tool_stream is enabled by default for Z.AI tool-call streaming. To disable it:Preserved thinking
Preserved thinking
Preserved thinking is opt-in because Z.AI requires the full historical
When enabled and thinking is on, OpenClaw sends
reasoning_content to be replayed, which increases prompt tokens. Enable it
per model:thinking: { type: "enabled", clear_thinking: false } and replays prior
reasoning_content for the same OpenAI-compatible transcript. The snake_case
preserve_thinking param key works as an alias.Advanced users can still override the exact provider payload with
params.extra_body.thinking.Image understanding
Image understanding
The Z.AI plugin registers image understanding.
Image understanding is auto-resolved from the configured Z.AI auth — no
additional config is needed.
Auth details
Auth details
- Z.AI uses Bearer auth with your API key.
- The
zai-api-keyonboarding choice auto-detects the matching Z.AI endpoint by probing supported endpoints with your key. - Use the explicit regional choices (
zai-coding-global,zai-coding-cn,zai-global,zai-cn) when you want to force a specific API surface. - The legacy env var
Z_AI_API_KEYis still accepted; OpenClaw copies it toZAI_API_KEYat startup ifZAI_API_KEYis unset.
Related
Model selection
Choosing providers, model refs, and failover behavior.
Configuration reference
Full OpenClaw config schema, including provider and model settings.