Matt Pocock (@mattpocockuk) asked: "Folks who are running GLM 5.2, how are you doing it? What harness/provider are you using?"
This guide answers in how-to form — one section per harness, step by step. Jump to the tool you use:
- How to run GLM 5.2 in Claude Code
- How to run GLM 5.2 in Pi
- How to run GLM 5.2 in ZCode
- How to run GLM 5.2 in OpenCode
- How to run GLM 5.2 in OpenClaw
- How to run GLM 5.2 in Codex
- How to run GLM 5.2 locally
Model context (benchmarks, vs Fable 5, export ban): GLM-5.2 explainer. Harness concepts: What Is an Agent Harness?.
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?.
Quick pick: which harness?
| You want… | Harness | Jump to |
|---|---|---|
| Fastest setup, official UX | ZCode | ZCode how-to |
| Already use Anthropic CLI | Claude Code | Claude Code how-to |
| Open source, any model | OpenCode | OpenCode how-to |
| Minimal harness you own | Pi | Pi how-to |
| Codex + open weights | Codex + Ollama | Codex how-to |
| Local inference | LM Studio / vLLM | Local how-to |
How do I get a GLM Coding Plan API key?
Most how-tos below assume a GLM Coding Plan subscription (Lite ~$18/mo, Pro, Max, Team).
- Sign up at z.ai
- Open z.ai/manage-apikey/apikey-list
- Create a Coding Plan API key (Team keys differ from personal keys — use the right one)
Endpoints you need:
| Harness type | Base URL |
|---|---|
| Claude Code | https://api.z.ai/api/anthropic |
| OpenAI-compatible tools (OpenCode, Cline, etc.) | https://api.z.ai/api/coding/paas/v4 |
| Pay-as-you-go API (not Coding Plan) | https://api.z.ai/api/paas/v4 |
Model IDs: glm-5.2 (standard) · glm-5.2[1m] (1M context in Claude Code)
Quota: GLM-5.2 costs 3× during peak (14:00–18:00 UTC+8), 2× off-peak — promo 1× off-peak through September 2026. Use GLM-4.7 for cheap routine tasks.
How to run GLM 5.2 in Claude Code
Z.ai lists Claude Code as a first-class Coding Plan client. You keep the same CLI; you swap the provider.
Step 1: Install Claude Code (if needed)
npm install -g @anthropic-ai/claude-code
cd your-project
claude
Step 2: Configure Z.ai credentials
Easiest — automated helper:
npx @z_ai/coding-helper
Manual — edit ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_zai_coding_plan_api_key",
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"API_TIMEOUT_MS": "3000000"
}
}
One-liner script (macOS/Linux):
curl -O "https://cdn.bigmodel.cn/install/claude_code_zai_env.sh" && bash ./claude_code_zai_env.sh
Restart the terminal or open a new Claude Code session after env changes.
Step 3: Select GLM-5.2
- Default model:
GLM-5.2orglm-5.2 - 1M context:
glm-5.2[1m]and setCLAUDE_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
claude
# Example: fix a failing test with file context
More commands: Claude Code reference. Long sessions: loop engineering.
How to run GLM 5.2 in Pi
Tadej Stanic (@tadejstanic) on Matt's thread: "It's Opus 4.8 level for sure. When you use in pi.dev harness…"
Step 1: Install Pi
curl -fsSL https://pi.dev/install.sh | sh
# or: npm install -g --ignore-scripts @earendil-works/pi-coding-agent
Step 2: Start Pi in your project
cd your-project
pi
Step 3: Connect Z.AI Coding Plan
- Run
/login(OAuth) or export your Coding Plan API key per pi.dev/docs - Select provider Z.AI Coding Plan (not generic Z.AI if you are on the subscription)
/modelor Ctrl+L →glm-5.2
Step 4: Configure reasoning effort
Pi maps effort for GLM-5.2 (earendil-works/pi#5770):
| Pi setting | Sends to GLM |
|---|---|
| low, medium, high | reasoning_effort: high |
| xhigh | reasoning_effort: max |
| thinking off | thinking disabled |
Step 5: Add verification (recommended)
Pi does not ship test loops by default. Paste a kickoff from ExplainX loops — e.g. ci-until-green.
Deeper Pi context: Pi harness guide. Heavier fork: oh-my-pi with Z.AI/GLM in its provider matrix.
How to run GLM 5.2 in ZCode
Sheeki (@sheeki03): "zcode.z.ai — the app is a copy of Codex, and it's good as well."
Zero manual endpoint config — Z.ai's official desktop agent.
Step 1: Subscribe to GLM Coding Plan
z.ai/subscribe — GLM-5.2 included on all tiers.
Step 2: Download ZCode
Get the app from zcode.z.ai (macOS, Windows, Linux).
Step 3: Sign in and select GLM-5.2
- Log in with your Z.ai account
- Choose GLM-5.2 as the active model
- Use
/goalfor long-horizon tasks (matches GLM-5.2's long-context positioning)
Check z.ai for in-app quota promos (community reported 50% extra usage and 1.5× effective quota offers — verify live before relying on them).
How to run GLM 5.2 in OpenCode
treysync (@0xtreysync): "OpenCode is my preference. Honestly been having comparable results to Opus."
Step 1: Install OpenCode
curl -fsSL https://opencode.ai/install | bash
# or: npm install -g opencode-ai
Full harness overview: OpenCode guide.
Step 2: Connect Z.AI Coding Plan
cd your-project
opencode
Inside the TUI:
/connect- Search Z.AI → select Z.AI Coding Plan
- Paste your Coding Plan API key
Step 3: Select GLM-5.2
/models- Choose GLM-5.2 (use GLM-4.7 for routine work to save quota)
Step 4: Initialize project memory
/init
Creates AGENTS.md — same filename as Codex.
Slash commands: OpenCode commands reference.
Custom config (if needed in opencode.json):
{
"provider": {
"zai": {
"options": {
"baseURL": "https://api.z.ai/api/coding/paas/v4"
}
}
}
}
How to run GLM 5.2 in OpenClaw
OpenClaw is on Z.ai's supported tool list. It embeds Pi via SDK — configure GLM like any custom Anthropic provider.
Steps
- Subscribe to GLM Coding Plan and get API key
- In OpenClaw provider settings, set:
- Base URL:
https://api.z.ai/api/anthropic(Anthropic-compatible path) - API key: your Coding Plan key
- Model:
glm-5.2
- Base URL:
- Read Is OpenClaw Safe? before routing subscription OAuth through third-party harnesses
Underlying harness: Pi guide.
How to run GLM 5.2 in Codex (via Ollama)
For OpenAI Codex users who want GLM weights without Z.ai Coding Plan routing in Claude Code:
Step 1: Pull GLM-5.2 in Ollama
ollama pull glm-5.2
Step 2: Launch Codex in OSS mode
ollama launch codex
# or manually:
codex --oss -m glm-5.2
Full setup: Codex + Ollama OSS guide.
This uses Ollama as model host + Codex as harness — separate from Coding Plan quota rules.
Complete AI Builder Bootcamp
Claude, Python automation & full-stack — 12 live sessions with Yash Thakker.
The Complete AI Builder Bootcamp is the best AI development course for learning Claude AI, prompt engineering, Python automation, and full-stack web development. This intensive 6-week live bootcamp teaches you how to build AI-powered applications using Claude Projects, Claude Artifacts, Claude Code, and the complete Claude ecosystem. You'll master prompt engineering techniques, learn to create custom Claude connectors and MCP integrations, build Python automation workflows, develop full-stack websites with AI assistance, and create AI marketing agents.
The bootcamp includes 12 live Zoom sessions with Yash Thakker, founder of AISOLO Technologies and instructor to 350,000+ students. You'll build 8+ portfolio projects including AI playbooks, full-stack note-taking applications, Python automation scripts, marketing agents, and personal portfolio websites. The curriculum covers AI fundamentals, Claude Projects and Artifacts, Claude Co-work, Claude plugins and skills, Claude Code for Python development, full-stack development, AI marketing, and capstone projects.
Students receive 1-year access to all recordings, permanent Discord community access, a certificate of completion, and personalized career guidance. All enrollments include a 7-day money-back guarantee. This is the most comprehensive Claude AI bootcamp available, taking students from zero AI knowledge to expert AI builder in 6 weeks.
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.
Step 1: Download weights
huggingface.co/zai-org/GLM-5.2 (MIT)
Step 2: Serve with your stack
- LM Studio — load model, enable OpenAI-compatible local server
- vLLM 0.23+ / SGLang 0.5.13+ — see GLM-5.1 local patterns (same workflow, model id
glm-5.2)
Step 3: Point your harness at localhost
| Harness | How |
|---|---|
| Pi | Custom provider in models.json → http://localhost:PORT/v1 |
| OpenCode | /connect → Ollama or LM Studio local provider |
| Claude Code | Not typical for local — use Pi or OpenCode instead |
How to run GLM 5.2 in Cursor, Cline, and other tools
Z.ai documents these in quick start:
| Tool | How to run GLM 5.2 |
|---|---|
| Cline | /connect or settings → OpenAI Compatible → https://api.z.ai/api/coding/paas/v4 → key → GLM-5.2 |
| Cursor | 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 maxonly 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.2orGLM-5.2, not a fallback likeglm-4.7orclaude-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, notapi.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,
/goalmarathons - 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"
Which harness should I pick?
| If you… | Start here |
|---|---|
| Want zero config | ZCode |
| Already live in Claude Code | Claude Code (how-to above) |
| Want open source + 75 providers | OpenCode |
| Want to own the harness | Pi |
| Want Codex UX + OSS weights | Codex + Ollama |
| Have a GPU cluster | Local vLLM + Pi/OpenCode |
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 |
Model benchmarks and ban context: GLM-5.2 explainer.
Related Reading
- GLM-5.2 Beats Fable 5 on Reasoning — China AI Response
- What Is an Agent Harness?
- Top 10 AI Agent Loops for Coding Workflows
- Pi: Minimal Agent Harness by Mario Zechner
- GLM-5.1: Hugging Face and Ollama Run Guide
- Codex Open-Source Models via Ollama
- oh-my-pi: Pi Fork with Z.AI/GLM Support
- Z.ai GLM Coding Plan docs
Endpoints, quota multipliers, and supported tools are accurate as of June 19, 2026 per docs.z.ai. Verify current promos on z.ai before subscribing.