Executive Summary
GLM 5.2 is a 756-billion parameter open-source model that can be routed into the Claude Code harness via Z.ai’s Anthropic-compatible API, delivering roughly 5x cheaper inference than Opus 4.8. Nate Herk’s tutorial demonstrates a full day of real-world testing: design tasks, creative one-shot builds, storm research, and coding — with GLM 5.2 handling ~80% of knowledge work competently and Opus reserved for the 10–20% that demand heavy reasoning. Setup is a single JSON config drop into .claude/settings.local.json. Per-project model switching is achieved by placing different config files in different directories — open Claude Code in the GLM folder to use GLM, open it in a folder without the config to use your default Opus subscription. The VS Code extension inherits the same settings, so once configured, GLM 5.2 works in the IDE exactly like any other model. The practical takeaway: models are engines, Claude Code is the harness — learn to switch engines per task, not per project.
Key Takeaways
- GLM 5.2 is 5x cheaper than Opus 4.8. Input: $1.40/M tokens vs. Opus $5. Output: $4.40/M tokens vs. Opus $25. Subscription plans available: $16, $64, or $144/month.
- Setup is one config file. Drop a JSON snippet into
.claude/settings.local.jsonwith your Z.ai API key, and Claude Code routes all traffic to GLM 5.2. No CLI changes, no wrapper scripts. - Per-project model switching. Place the GLM config in
project-a/.claude/settings.local.jsonfor one project, omit it inproject-b/for default Opus. VS Code extension picks it up automatically. - 80/20 rule for model selection. GLM 5.2 handles most knowledge work (design, research, documentation, creative builds). Reserve Opus for tasks requiring deep multi-step reasoning, subtle edge cases, or complex debugging.
- Open-source means ownership. Unlike Fable 5 (which was pulled overnight), GLM 5.2 can be downloaded and run locally if you have the hardware. The API route via Z.ai is a convenience, not a dependency.
Tutorial: Step-by-Step Setup
1 Get Your Z.ai API Key
Step 1: Go to z.ai and create an account. You can try GLM 5.2 directly in their web chat first — it supports landing page generation, 3D modeling, mini-games, and front-end design.
Step 2: Choose a plan or pay-per-token. Plans: $16/mo, $64/mo, $144/mo (yearly discount available). Pay-per-token: $1.40/M input, $4.40/M output. Nate’s recommendation: pair a $100 Claude plan with a $64 Z.ai plan and switch between them per task.
Step 3: In the Z.ai console, go to API Keys and create a new key. Copy it — you’ll paste it into the Claude Code config.
2 Configure Claude Code
This is the core setup. Create or edit .claude/settings.local.json in your project root (or global config). Drop in this JSON block, replacing the API key with yours:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_AUTH_TOKEN": "your-z-ai-api-key",
"ANTHROPIC_API_KEY": "",
"API_TIMEOUT_MS": "3000000",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.2",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.2",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.2",
"ANTHROPIC_SMALL_FAST_MODEL": "glm-5.2",
"CLAUDE_CODE_SUBAGENT_MODEL": "glm-5.2"
}
}
What’s happening: ANTHROPIC_BASE_URL redirects all API calls from Anthropic’s endpoint to Z.ai’s endpoint. All model defaults are remapped to glm-5.2. The API_TIMEOUT_MS of 3,000,000 (50 minutes) accounts for GLM’s slower performance on reasoning-heavy tasks. The ANTHROPIC_API_KEY is left empty because authentication is handled via ANTHROPIC_AUTH_TOKEN with your Z.ai key.
Alternative: You can also ask Claude Code to do this: “Put this config into my settings.local.json” and paste the block. Nate provides the exact config in his video description.
3 Verify It’s Working
Open Claude Code in the project directory where you placed the config. The status bar or session header should show GLM 5.2 with 1M context — API usage billing. If you see Opus, the config isn’t being picked up — check that settings.local.json is in the correct directory (project-level .claude/ or global config path).
Quick test: run /goal with a simple task like “Build me a creative HTML page about space” and verify the model responds with GLM 5.2 quality (slightly different style from Opus, but solid).
4 Per-Project Model Switching
This is the most powerful workflow. Create two project folders:
~/projects/
├── glm-project/
│ └── .claude/settings.local.json ← GLM 5.2 config
└── opus-project/
└── (no settings.local.json) ← defaults to your Claude plan
Open Claude Code in glm-project/ → uses GLM 5.2. Open in opus-project/ → uses your default Opus subscription. VS Code extension: the Claude Code extension reads the same .claude/settings.local.json per workspace. Open a VS Code workspace in the GLM folder, and the extension uses GLM. Open a workspace in the Opus folder, and it uses default Opus. No manual switching required.
When to Use GLM 5.2 vs. Opus
5 What GLM 5.2 Excels At
Creative one-shot builds: “Build me an interactive HTML page” → solid results, often faster than Opus (GLM: 3m59s vs. Opus: 14m59s for equivalent design tasks). Design work: GLM produced a landing page nearly indistinguishable from Opus in Nate’s side-by-side test. Storm research: multi-agent research with subagents, verification checks, and HTML reports — GLM handled it well because the skill orchestration mattered more than the underlying model. Documentation and boilerplate: READMEs, config files, slide decks (Nate’s entire presentation was built by GLM 5.2 using his slide deck skill). Daily knowledge work: about 80% of tasks that don’t require deep multi-step reasoning.
6 When Opus Is Still Necessary
Heavy reasoning tasks: GLM 5.2 took 24 minutes for a complex task that Opus completed in 5 minutes. Subtle edge cases: in Nate’s homework assignment test, GLM missed duplicate record handling (true vs 1, 1 vs 1.0) that Opus caught. Complex debugging: multi-step debugging with deep context and intricate logic. Strategic thinking: “Based on all this research data, what really matters and how do I apply it?” — Nate reserves this for Opus. The rule of thumb: use GLM for the 80% that’s research, design, documentation, and boilerplate. Switch to Opus for the 10–20% that requires precision reasoning.
Benchmarks & Pricing
7 Benchmarks: Where GLM 5.2 Stacks Up
GLM 5.2 is competitive with top-tier closed-source models across major benchmarks:
- Frontier SWE: GLM 5.2 outperformed GPT 5.5 on this software engineering benchmark.
- Aider coding: beats Sonnet and Opus 4.7 on multiple evaluations.
- General knowledge: comparable to Opus 4.8 and GPT 5.5 on most knowledge benchmarks.
- Caveat: Nate emphasizes that benchmarks should be taken “with a grain of salt” — real-world feel matters more. GLM 5.2 “feels” solid for most tasks but lacks the reasoning depth of Opus on complex multi-step problems.
8 Pricing Comparison
| Model | Input (/M tokens) | Output (/M tokens) |
|---|---|---|
| Opus 4.8 | $5.00 | $25.00 |
| GLM 5.2 | $1.40 | $4.40 |
| Savings | 3.6x cheaper | 5.7x cheaper |
Z.ai subscription plans: $16/mo, $64/mo, $144/mo. Nate’s 5-hour heavy usage session on the $60/mo plan consumed roughly half his 5-hour quota and 10% of his weekly quota — plenty of headroom for daily knowledge work.
Risks, Gaps & Uncertainty
- Quota limits. Z.ai plans have 5-hour and weekly quotas (similar to Claude Code subscriptions). Heavy reasoning tasks consume quota faster. Peak hours may consume higher multiples.
- Speed variance. GLM 5.2 is unpredictable: sometimes faster than Opus (design tasks), sometimes dramatically slower (complex reasoning). Set generous timeouts (API_TIMEOUT_MS: 3000000).
- Subagent reliability. GLM subagents worked in Nate’s storm research test but may behave differently than Opus subagents. Test your specific agent workflows before committing.
- API compatibility. Z.ai’s Anthropic-compatible API is an emulation layer. Edge cases in the Anthropic API spec may not be fully supported. Claude Code features that depend on specific Anthropic API behavior may not work.
- Open-source but not self-hosted (yet). At 756B parameters, self-hosting requires substantial hardware. Most users will rely on Z.ai’s cloud API — which means you’re still renting, just from a different provider. True ownership requires hardware investment.
Recommended Next Actions
Run the 5-minute setup. Create a Z.ai account (free tier available), grab an API key, drop the config into .claude/settings.local.json. Test with a simple /goal prompt. Verify GLM 5.2 appears in the session header.
Set up per-project model switching. Create a glm-projects/ folder with the GLM config, keep your main projects on default Opus. Open VS Code workspaces accordingly. Get comfortable with “which model for which task.”
Run a side-by-side comparison. Take one real task from your workflow. Run it through GLM 5.2 and Opus. Compare: time, cost, quality. Build your own intuition for when GLM is sufficient vs. when Opus is necessary.
Test with your existing skills and agents. If you use Claude Code skills, MCP servers, or agent teams, verify they work correctly with GLM 5.2. Nate confirmed his storm research skill and slide deck skill worked — your mileage may vary with custom skills.
Track cost savings. Compare your API billing between GLM-only days and Opus-only days. Use the 80/20 rule: GLM for the majority, Opus for the critical. Target 3–5x cost reduction on daily knowledge work.
Annotated References
[1] Herk, N. (2026). GLM 5.2 in Claude Code is Blowing My Mind. YouTube. Watch
Primary source. Full day of testing GLM 5.2 in Claude Code: design tasks, creative builds, storm research, coding. Complete setup walkthrough with config, pricing, benchmarks, and per-project switching.
[2] Z.ai. (2026). GLM 5.2 API Console & Documentation. Visit
Official API platform for GLM 5.2. Pricing, plans, API keys, and Anthropic-compatible endpoint documentation.
[3] Anthropic. (2026). Claude Code Documentation — Settings & Configuration. View
Official documentation for Claude Code settings, environment variables, and model configuration. Reference for settings.local.json structure.