Z.AI is the API platform for GLM models. It provides REST APIs for GLM and
uses API keys for authentication. Create your API key in the
Z.AI console.
Apus uses the zai provider with a Z.AI API key.
| Property | Value |
|---|---|
| Provider | zai |
| Package | @openclaw/zai-provider |
| Auth | ZAI_API_KEY (legacy alias: Z_AI_API_KEY) |
| API | Z.AI Chat Completions (Bearer auth) |
GLM models
GLM is a model family, not a separate provider. In Apus, GLM models use
refs such as zai/glm-5.3: provider zai, model id glm-5.3.
Getting started
Install the provider plugin first:
apus plugins install @openclaw/zai-provider
Auto-detect endpoint
**Best for:** most users. Apus checks supported Z.AI endpoints with your API key and applies the correct base URL automatically.
Run onboarding
```bash
apus onboard --auth-choice zai-api-key
```
Verify the model is listed
```bash
apus models list --all --provider zai
```
Explicit regional endpoint
**Best for:** users who want to force a specific Coding Plan or general API surface.
Pick the right onboarding choice
```bash
# Coding Plan Global (recommended for Coding Plan users)
apus onboard --auth-choice zai-coding-global
# Coding Plan CN (China region)
apus onboard --auth-choice zai-coding-cn
# General API
apus onboard --auth-choice zai-global
# General API CN (China region)
apus onboard --auth-choice zai-cn
```
Verify the model is listed
```bash
apus models list --all --provider zai
```
Endpoints
| Onboarding choice | Base URL | Default model |
|---|---|---|
zai-global |
https://api.z.ai/api/paas/v4 |
glm-5.2 |
zai-cn |
https://open.bigmodel.cn/api/paas/v4 |
glm-5.2 |
zai-coding-global |
https://api.z.ai/api/coding/paas/v4 |
glm-5.3 |
zai-coding-cn |
https://open.bigmodel.cn/api/coding/paas/v4 |
glm-5.3 |
Z.AI also publishes the Anthropic-compatible Coding Plan base URL
https://api.z.ai/api/anthropic. Apus's Z.AI choices use the documented
OpenAI Chat Completions endpoints above; the Anthropic URL is for clients that
speak Anthropic Messages directly.
zai-api-key auto-detects one of these four by checking 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 Apus, 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".
If you see a temporary 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:
apus models list --all --provider zai
apus config get models.providers.zai.baseUrl
Coding Plan keys should use a Coding Plan endpoint such as
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
zai-api-key lets Apus detect the matching Z.AI endpoint from the key and
apply the correct base URL automatically. Use the explicit regional choices when
you want to force a specific Coding Plan or general API surface.
{
env: { vars: { ZAI_API_KEY: "sk-..." } },
models: {
providers: {
zai: {
// GLM-5.3 uses the Coding Plan endpoint.
baseUrl: "https://api.z.ai/api/coding/paas/v4",
},
},
},
agents: { defaults: { model: { primary: "zai/glm-5.3" } } },
}
Built-in catalog
The zai provider plugin ships its catalog in the plugin manifest, so read-only
listing can show known GLM rows without loading provider runtime:
apus models list --all --provider zai
The manifest-backed catalog includes:
| Model ref | Notes |
|---|---|
zai/glm-5.3 |
Coding Plan default; 1,048,576-token context |
zai/glm-5.3-flash |
Multimodal text and image model; 1,048,576 context |
zai/glm-5.2 |
General API default; 1M context |
zai/glm-5-turbo |
Apus-optimized text model; 200K context |
zai/glm-5v-turbo |
Multimodal coding model; 200K context |
zai/glm-5.1 |
Deprecated; hidden unless configured; use GLM-5.2 |
Pay-as-you-go catalog rows follow Z.AI's current API pricing. GLM-5.3 Flash uses its pay-as-you-go list prices even when temporary discounts are available. GLM-5.3 is currently a Coding Plan model, so its local catalog cost is zero; Coding Plan subscriptions use plan quota instead of per-token billing. See the live subscription page for plan pricing and availability.
GLM models are available as zai/<model> (example: zai/glm-5.3).
Fresh Coding Plan setup defaults to zai/glm-5.3; general API setup remains on
zai/glm-5.2. On Coding Plan endpoints, auto-detection falls back through
glm-5.1 and glm-4.7 when a key or regional endpoint does not expose GLM-5.3
directly. Z.AI currently routes Coding Plan requests for GLM-5.2 and GLM-5.1 to
GLM-5.3. Run
apus models list --all --provider zai to see the catalog known to your
installed version.
Video generation
The same plugin and ZAI_API_KEY (or Z_AI_API_KEY) support the
video generation tool with zai/cogvideox-3.
It accepts text prompts or one PNG/JPEG image, including local files sent
as data URIs (maximum 5 MB). Video references are unsupported.
Durations normalize to 5 or 10 seconds. Size and aspect-ratio hints map to
the nearest supported size: 1280x720, 720x1280, 1024x1024,
1920x1080, 1080x1920, 2048x1080, or 3840x2160.
Output defaults to 720P landscape without audio; audio: true enables sound.
Use providerOptions.quality (speed or quality) and providerOptions.fps
(30 or 60) for further control.
Video uses the configured global or China region's general /api/paas/v4
endpoint. Coding Plan chat endpoints map to the general video endpoint in
the same region; video requires API access and billing for that endpoint.
{
agents: {
defaults: {
mediaModels: {
video: { primary: "zai/cogvideox-3" },
},
},
},
}
Thinking levels
GLM-5.3 and Flash
Levels: `low`, `high`, and `max` (default `max`). Apus maps these to
Z.AI's `reasoning_effort` request field. An explicit `off` setting maps to
`reasoning_effort: "low"` because GLM-5.3 models do not support disabling
reasoning entirely.
GLM-5.2
Full range: `off`, `low`, `high`, `max` (default `off`). Apus 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.
Other GLM models
Binary toggle only: `off` and `low` (shown as `on` in pickers), default
`off`. Setting thinking to `off` sends `thinking: { type: "disabled" }`;
any other level leaves the request payload untouched (Z.AI's own default
reasoning behavior applies).
Setting thinking to off avoids responses that spend the output budget on
reasoning_content before visible text.
Advanced configuration
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_stream` is enabled by default for Z.AI tool-call streaming. To disable it:
```json5
{
agents: {
defaults: {
models: {
"zai/<model>": {
params: { tool_stream: false },
},
},
},
},
}
```
Preserved thinking
Preserved thinking is opt-in because Z.AI requires the full historical
`reasoning_content` to be replayed, which increases prompt tokens. Enable it
per model:
```json5
{
agents: {
defaults: {
models: {
"zai/glm-5.3": {
params: { preserveThinking: true },
},
},
},
},
}
```
When enabled and thinking is on, Apus sends
`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
The Z.AI plugin registers image understanding.
| Property | Value |
| ------------- | ----------- |
| Model | `glm-4.6v` |
Image understanding is auto-resolved from the configured Z.AI auth — no
additional config is needed.
Auth details
- Z.AI uses Bearer auth with your API key.
- The `zai-api-key` onboarding choice auto-detects the matching Z.AI endpoint by checking 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_KEY` is still accepted; Apus copies it to `ZAI_API_KEY` at startup if `ZAI_API_KEY` is unset.
Related
Model selection
Choosing providers, model refs, and failover behavior.
Configuration reference
Full Apus config schema, including provider and model settings.