GLM 5.2
in Claude Code
Setup tutorial · 5x cheaper than Opus · Per-project switching · June 2026
glm-5.2claude-codevscodeopen-source
Provenance Labs · Gambit (Hermes)High Confidence
Executive Summary

GLM 5.2 is a 756B parameter open-source model you can route into Claude Code via Z.ai. 5x cheaper than Opus 4.8. Handles ~80% of knowledge work. One config file, per-project switching, works in VS Code extension.

5 Min Setup

Z.ai API key + one JSON config in .claude/settings.local.json. No CLI changes.

5x Cheaper

Input $1.40 vs $5. Output $4.40 vs $25. Plans from $16/mo.

Per-Project

Different config per folder. VS Code extension inherits automatically.

80/20 Rule

GLM for most tasks. Opus for heavy reasoning. Models are engines, harness is the car.

Setup: Steps 1-3
API key, config file, verify

Step 1: z.ai → create account → pick plan ($16/$64/$144) → API Keys → copy key.
Step 2: Drop config into .claude/settings.local.json.
Step 3: Open Claude Code → verify "GLM 5.2 1M context" in header.

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "your-z-ai-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"
  }
}

All model defaults → glm-5.2. Timeout 50 min. Auth via Z.ai key.

Per-Project Switching + VS Code
One config per folder, zero friction

Claude Code is a harness. The model is the engine. Switch engines by changing which folder you open.

~/projects/
  glm-project/
    .claude/settings.local.json  ← GLM 5.2
  opus-project/
    (no config)                  ← Default Opus
When GLM 5.2 Wins
80% of your knowledge work, 5x cheaper

GLM 5.2: 3m 59s for a design task that took Opus 14m 59s. Equivalent quality. Creative, fast, cheap.

When Opus Is Still Necessary
The 10-20% that demands precision

GLM: 24 min vs. Opus: 5 min on complex reasoning. GLM missed duplicate record edge cases (true vs 1) that Opus caught.

Benchmarks
Where GLM 5.2 stacks up against closed-source models

GLM 5.2 is competitive with Opus 4.8, GPT 5.5, and Sonnet across major benchmarks. But Nate: "Take benchmarks with a grain of salt -- feel matters more."

Pricing: The 5x Story
Why this matters for daily workflow economics
ModelInput/M tokOutput/M tok
Opus 4.8$5.00$25.00
GLM 5.2$1.40$4.40
Savings3.6x5.7x
Risks & Gotchas

Get Started

Sources
3 sources · 3 Tier 1

Tier 1 = Primary source (tutorial, official docs, API platform) · Tier 2 = Community resource · Tier 3 = News

Generated June 21, 2026 · DeepSeek V4 Pro · Gambit / brief-to-slides v2.0