How do I run GLM 5.2 in OpenCode?
Use z-ai/glm-5.2 with a Standard Compute key: GLM 5.2 comes with every plan from $19 a month, and usage draws on a compute budget that sends HTTP 402 to new requests at 100%. OpenCode, Claude Code and Kilo Code all take the same ID.
| Model | Z.ai's release before GLM 5.3, built for long-horizon agent workflows and project-level software engineering. |
|---|---|
| Model ID | z-ai/glm-5.2Short form glm-5.2 also works |
| Model ID, US pin | z-ai/glm-5.2:usServed from the US |
| Base URL | https://api.stdcmpt.com/v1Claude Code uses https://api.stdcmpt.com |
| Context | 1,048,576 tokensA request here takes up to about 850K input and 50K output tokens |
| Input | Text only |
| Reasoning | On or off, per request or on the Models page |
Copy a working config
Paste the config for your agent. Swap in z-ai/glm-5.3 to try the newer model on the same key.
{
"$schema": "https://opencode.ai/config.json",
"model": "standardcompute/z-ai/glm-5.2",
"provider": {
"standardcompute": {
"npm": "@ai-sdk/openai-compatible",
"name": "Standard Compute",
"options": {
"baseURL": "https://api.stdcmpt.com/v1",
"apiKey": "{env:STANDARDCOMPUTE_API_KEY}"
},
"models": {
"z-ai/glm-5.2": { "name": "GLM 5.2" },
"standardcompute": { "name": "Smart routing" }
}
}
}
}
Replace YOUR_API_KEY with a key from the dashboard. This config reads your key from STANDARDCOMPUTE_API_KEY; export it with a key from the dashboard. Full setup: OpenCode, Claude Code, Kilo Code.
What it costs
| Per 1M tokens | GLM 5.2 |
|---|---|
| Input | $1.40 |
| Cached input | $0.26 |
| Output | $4.40 |
Z.ai API rates. Cache storage is listed as free for a limited time. Source: Z.ai API pricing, checked October 13, 2026.
Most new setups should start on GLM 5.3; 5.2 stays here for agents already tuned on it.
What works differently here
- GLM 5.2 only switches reasoning on or off; effort levels make no difference.
- It is text-only. Select a vision model such as GLM 5.3 Flash next to it if your agent sends screenshots.
- If GLM is all you use, compare Z.ai's own GLM Coding Plan first. A Standard Compute plan fits when GLM shares the month with other vendors' models.
Other ways to run GLM 5.2
| Z.ai APIPay per token | First-party, with cached input and free cache storage for now. |
|---|---|
| GLM Coding Plan (Z.ai)Subscription | Z.ai's own plan for coding tools; GLM models only. |
| OpenRouter hostsPay per token | Several hosts at their own rates and speeds. |
| Standard ComputeMonthly plan | GLM 5.2 with a US pin, next to GLM 5.3 and other vendors on one key. |
FAQ
Is GLM 5.2 cheaper than GLM 5.3?
Not on Z.ai's list: both cost the same per token. GLM 5.3 is the newer model and takes reasoning levels from minimal to high.
Can I keep GLM 5.2 requests in the US?
Yes, with the US pin. It takes the same text-only input as the base ID.
Sources: Z.ai API pricing
Create your key
Sign in, create a key in the dashboard and paste it into the config above.