If DeepSeek is the cheapest way to give OpenClaw a brain, GLM is the most predictable. Z.AI’s GLM models come with a flat monthly coding plan, which means an always-on assistant costs the same whether it has a quiet week or a busy one. For anyone who’d rather not watch a token meter, that fixed cost is the whole appeal.
This guide sets up OpenClaw with GLM: the config, the plan-versus-pay-per-token decision, key handling, and the usage caps worth knowing about. It assumes OpenClaw is installed — if not, see the Windows and WSL install guide first.
Why GLM for OpenClaw
The reason to pick GLM over a pure pay-per-use model is billing. A flat coding plan turns a variable, slightly nerve-wracking cost into a line item you forget about. That matters more with OpenClaw than with a chat tool, because an assistant on a schedule works in the background — and on a flat plan, background work doesn’t move the bill.
GLM vs DeepSeek for OpenClaw
| GLM (coding plan) | |
| Billing | Flat monthly subscription |
| Best for | Heavy, daily, always-on use |
| Cost certainty | Fixed |
| Caps | Rolling-window usage limits |
If your use is light or unpredictable, DeepSeek is probably cheaper. If you lean on OpenClaw all day, GLM’s plan usually wins.
Step 1: get a GLM key and pick a billing model
Sign up with Z.AI, decide between the coding plan and pay-per-token, and generate an API key. Note the base URL and current model names from the Z.AI developer docs. The plan-versus-token choice is worth a moment — estimate how much you’ll actually run OpenClaw before committing, since the plan only pays off above a certain volume.
Step 2: store the key in an environment variable
export GLM_API_KEY="your-z-ai-key"
Add it to your shell profile (~/.bashrc or ~/.zshrc) so it survives new sessions. As always, keep it out of any config file you might share.
Step 3: configure OpenClaw to use GLM
Set GLM as the model provider in OpenClaw’s config, using Z.AI’s base URL and a GLM model name, with the key pulled from the environment. Config shapes change between versions, so confirm against the OpenClaw repo; the values you’re providing stay the same:
{
"model": {
"provider": "openai-compatible",
"base_url": "https://api.z.ai/api/paas/v4",
"api_key_env": "GLM_API_KEY",
"model": "glm-5"
}
}
Confirm the exact base URL and model name in Z.AI’s docs — those are the two values most likely to differ from this example. Everything else is OpenClaw’s standard provider setup.
Step 4: test it
Start OpenClaw and hand it a task that uses a capability, not just chat:
Read the files in this folder and tell me which ones changed most recently.
A sensible answer means GLM is connected and the assistant can act. If the model talks but can’t reach files, the model is fine and you’re looking at a skill or permission, not GLM.
OpenClaw + GLM checklist
- Z.AI account created; coding plan vs pay-per-token decided
- API key generated and set as an environment variable
- OpenClaw provider set to Z.AI's base URL with a GLM model
- Per-window usage cap checked if you're on the plan
- Tested with a task that touches files
When GLM is the right call
Reach for GLM when predictability matters more than squeezing the last cent. A flat plan suits someone who runs OpenClaw as a daily driver — scheduled jobs, frequent tasks, an assistant they actually lean on. If instead you fire it up occasionally, the plan’s monthly cost is dead weight and DeepSeek’s pay-per-use is the better fit.
Wrapping up
Setting OpenClaw up on GLM is the same short config as any provider — base URL, key from an environment variable, model name — with one extra decision up front: the coding plan versus pay-per-token. Choose the plan if you run OpenClaw hard every day and want a fixed cost, and mind the rolling-window cap so a busy day doesn’t surprise you.
For the alternatives, compare against DeepSeek, or skip API costs entirely with a local Ollama setup.