How to Run GLM 5.2 in Claude Code, Pi, OpenCode & Every Harness (2026)
How do you run GLM 5.2? Step-by-step for Claude Code, Pi, ZCode, OpenCode, OpenClaw, Codex+Ollama, and local inference — API keys, endpoints, model IDs, effort levels, and quota tips.
Every section below follows the same pattern: what you need, which endpoint to use, how to select glm-5.2, and how to map reasoning effort. If you already have a Coding Plan key, jump straight to your harness. If not, start with How do I get a GLM Coding Plan API key?.
Restart the terminal or open a new Claude Code session after env changes.
Step 3: Select GLM-5.2
Default model: GLM-5.2 or glm-5.2
1M context:glm-5.2[1m] and set CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000
Step 4: Set reasoning effort
Use /effort in Claude Code:
Claude Code /effort
GLM-5.2 maps to
low, medium, high
high
xhigh, max
max
Use high for daily coding; max for architecture refactors and hard bugs.
Common Claude Code mistakes: using the general api/paas/v4 URL instead of the Anthropic-compatible path; putting the key in ANTHROPIC_API_KEY when Z.ai docs specify ANTHROPIC_AUTH_TOKEN; forgetting to restart the terminal after editing settings.json. If Claude Code still hits Anthropic's servers, run echo $ANTHROPIC_BASE_URL — it should print https://api.z.ai/api/anthropic.
Step 5: Run your first task
bash
claude
# Example: fix a failing test with file context
This uses Ollama as model host + Codex as harness — separate from Coding Plan quota rules.
How to run GLM 5.2 locally (LM Studio / vLLM)
Szymon (@Szymon_Lorenz) uses LM Studio. Henry Mascot noted ~256GB RAM for full local GLM-5.2 — plan for cluster/quantized serving, not a laptop default.
Custom OpenAI-compatible provider → same base URL + model
Factory + vibeproxy
Coding Plan key through proxy (community pattern)
Crush / Goose / Roo Code / Kilo Code
Same OpenAI-compatible pattern per Z.ai tool list
HCC (@HCColenbrander) warns Z.ai uptime can be spotty — keep GLM-4.7 or a fallback harness for deadline days.
How to run GLM 5.2 in Cursor specifically: open Settings → Models → Add custom provider. Set base URL to https://api.z.ai/api/coding/paas/v4, paste your Coding Plan key, and enter GLM-5.2 as the model name. Cursor treats this like any OpenAI-compatible endpoint — no Anthropic URL needed. Same pattern works in Windsurf, Continue, and other editors that accept a custom OpenAI base URL.
How to use Coding Plan MCP servers
Included on all tiers: Vision, Web Search, Web Reader, Zread (Z.ai docs). Enable in Claude Code or ZCode for mockup-to-code and live doc lookup.
How do I enable 1M context on GLM 5.2?
In Claude Code only (documented pattern):
Set model to glm-5.2[1m]
Export or set CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000
Use /effort max only when the task truly needs full-repo context
Other harnesses: check provider docs — OpenCode and ZCode may expose 1M natively depending on build.
How do I verify GLM 5.2 is actually running?
Before burning quota on a long agent session, confirm the model and endpoint are wired correctly:
Check the model name — the harness should show glm-5.2 or GLM-5.2, not a fallback like glm-4.7 or claude-sonnet.
Ask a identity probe — "What model are you?" GLM-5.2 should self-identify correctly; if it says Claude or GPT, your provider routing is wrong.
Watch the first API call — in Claude Code, enable verbose logging or check that requests go to api.z.ai, not api.anthropic.com.
Run a small coding task — fix one failing test or add a typed function. GLM-5.2 should produce coherent multi-file edits on the first turn.
If verification fails, re-check the base URL table in How do I get a GLM Coding Plan API key? — Anthropic-compatible harnesses and OpenAI-compatible harnesses use different paths.
How do I avoid burning through GLM 5.2 quota?
GLM-4.7 — lint fixes, small edits, doc Q&A
GLM-5.2 + high effort — features, multi-file refactors
GLM-5.2 + max effort — architecture, heisenbugs, /goal marathons
Schedule heavy runs outside 14:00–18:00 UTC+8 when off-peak promo applies
Add deterministic verification — agent loops so GLM is not the judge of "done"
None replace tests or CI as exit criteria — GLM-5.2 reasons well; your harness still needs a verification loop.
Summary
How to run GLM 5.2 is a harness question, not a model question. Pick your tool, follow the matching section above, and verify the endpoint before long sessions:
Question
Short answer
How to run GLM 5.2 in Claude Code?
ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic + Coding Plan key + glm-5.2
How to run GLM 5.2 in Pi?
/login → Z.AI Coding Plan → /model → glm-5.2
How to run GLM 5.2 in ZCode?
Sign in at zcode.z.ai, select GLM-5.2
How to run GLM 5.2 in OpenCode?
/connect → Z.AI Coding Plan → /models → GLM-5.2
How to run GLM 5.2 locally?
HF weights + LM Studio/vLLM + localhost provider in Pi or OpenCode