Skip to content

Use GLM 5.2 with Claude Code

Claude Code doesn’t require a Claude model: it works with any backend that speaks the Anthropic Messages API. CheapestInference exposes GLM 5.2 through an Anthropic-compatible endpoint, so you can run Claude Code on GLM with unlimited usage during your reserved time blocks — a flat monthly fee instead of per-token billing.

  1. Subscribe to the Frontier Pool and copy your subscriber key (sk-...) from the dashboard.
  2. Export these variables in your shell (or put them in your shell profile):
Terminal window
export ANTHROPIC_BASE_URL="https://api.cheapestinference.com/anthropic"
export ANTHROPIC_AUTH_TOKEN="sk-..." # your subscriber key
export ANTHROPIC_MODEL="glm-5.2"
export ANTHROPIC_SMALL_FAST_MODEL="glm-5.2"
export CLAUDE_CODE_AUTO_COMPACT_WINDOW=198000 # GLM 5.2's 198K window
  1. Start claude as usual. Every request now runs on GLM 5.2.
  • Built for coding and agentic work: GLM 5.2 is Zhipu’s frontier coding model — strong on multi-step tool use, exactly what Claude Code exercises.
  • Flat price: coding agents are token-hungry; a long Claude Code session can burn millions of tokens. During your time blocks there is no per-token meter — see Unlimited Subscriptions.
  • Thinking blocks: GLM’s reasoning surfaces through standard Anthropic thinking content blocks, so Claude Code renders it natively. See Reasoning for toggling it.
  • 198K context: set CLAUDE_CODE_AUTO_COMPACT_WINDOW=198000 (as above) so Claude Code compacts the session before hitting the window instead of erroring mid-task.

Pin one project to GLM without touching your global shell profile with .claude/settings.json in the project:

{
"env": {
"ANTHROPIC_BASE_URL": "https://api.cheapestinference.com/anthropic",
"ANTHROPIC_AUTH_TOKEN": "sk-...",
"ANTHROPIC_MODEL": "glm-5.2",
"ANTHROPIC_SMALL_FAST_MODEL": "glm-5.2",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "198000"
}
}

Yes. Claude Code talks to any endpoint that implements the Anthropic Messages API. Point ANTHROPIC_BASE_URL at https://api.cheapestinference.com/anthropic, set ANTHROPIC_MODEL to glm-5.2, and Claude Code runs on GLM — tool calls, streaming and thinking blocks included. No plugin or proxy on your machine.

How does GLM 5.2 compare to Claude for coding agents?

Section titled “How does GLM 5.2 compare to Claude for coding agents?”

GLM 5.2 is one of the strongest open-weights coding models and holds its own on multi-step agentic work; frontier closed models still lead on the hardest tasks. The practical difference is economics: a heavy Claude Code month on a per-token API bills every token, while a Frontier Pool subscription is a flat fee — see the numbers in the LLM API pricing comparison.

What does it cost to run Claude Code on GLM?

Section titled “What does it cost to run Claude Code on GLM?”

A flat monthly subscription to the Frontier Pool — see current prices. Usage during your reserved time blocks is unlimited, so a heavy week costs the same as a light one.

  • Your Frontier Pool subscription also covers MiniMax M3 with its 1M window — switch models by changing ANTHROPIC_MODEL, no new key needed.
  • Lighter and cheaper: DeepSeek V4 Flash (Core Pool). Heavier: Kimi K3 (Flagship Pool).
  • General setup, model table and troubleshooting: the main Claude Code guide.