← All guides

How to use GLM in Claude Code

Zhipu's GLM models — now led by the GLM-5.3 line, the top-ranked open-weight coding model — have become a strong cheap-but-capable pick for agent coding, and Claude Code can run on them directly. Here's how to connect GLM, what to check, and a cleaner path when you want to switch models freely.

TL;DR: Zhipu exposes an Anthropic-compatible endpoint for GLM, so you can run Claude Code on it: set ANTHROPIC_BASE_URL to https://open.bigmodel.cn/api/anthropic and ANTHROPIC_AUTH_TOKEN to your Zhipu key, then pick a GLM model such as glm-5.3 or glm-5.3-flash. GLM-5.3 (released August 2026) is currently the strongest open-weight coding model, and GLM-5.3-Flash is a low-cost, native-multimodal 1M-context variant. It's a global endpoint swap, though — switching back to Claude means editing env vars and restarting. An agent that treats the model as a setting avoids that.

GLM + Claude Code: the short version

GLM is served by Zhipu (BigModel), which publishes an Anthropic-compatible endpoint precisely so Claude Code and similar tools can point at it directly. You supply your own Zhipu key, usage is billed to you, and there's no translating proxy required — Claude Code talks to GLM as if it were an Anthropic endpoint. The newer GLM-5.3 line offers a very large (1M) context variant for big codebases.

What's new: GLM-5.3 and GLM-5.3-Flash

Zhipu released GLM-5.3 in August 2026 as the strongest coding model in its open-weight family — Zhipu reports a roughly 50% improvement over GLM-5.2 on its internal agent-coding evaluations, and top-of-leaderboard results among open models on suites like Terminal-Bench 3.0. Shortly after came GLM-5.3-Flash, the series' first natively multimodal model: a 320B-total / 18B-active sparse-attention architecture with a 1M-token context, open-weighted and priced for very low cost. For everyday Claude Code work, GLM-5.3-Flash is the value pick and GLM-5.3 the heavier one; both point at the same Anthropic-compatible endpoint.

The config

What to set

  1. ANTHROPIC_BASE_URLPoint it at Zhipu's Anthropic-compatible base: https://open.bigmodel.cn/api/anthropic
  2. ANTHROPIC_AUTH_TOKENYour Zhipu (BigModel) API key — usage billed to your Zhipu account.
  3. ModelSelect a GLM model (e.g. glm-4.7 for light work, glm-5.2 or glm-5.2[1m] for the large-context variant). Use the exact name the endpoint exposes.
# Point Claude Code at Zhipu/GLM's Anthropic-compatible endpoint
export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"
export ANTHROPIC_AUTH_TOKEN="your-zhipu-key"
# then run claude as usual, selecting a GLM model (e.g. glm-5.2)
Reality check: this is a global switch. There's no in-app 'GLM for this, Claude for that' — you change env vars and restart to move between them. If Claude Code stalls on the onboarding screen the first time, add "hasCompletedOnboarding": true to ~/.claude.json, and set a long API_TIMEOUT_MS for big tasks.

Why route Claude Code to GLM

Value

GLM's 4.7 and 5.2 lines are a strong capability-per-dollar pick for everyday agent coding.

Long context

The GLM-5.2 1M-context variant handles bigger repositories in one session.

Fallback for Claude limits

Somewhere to route when your Claude plan is rate-limited or capped.

The cleaner option: GLM as a one-click setting

The endpoint swap works, but Claude Code is single-provider by design, so mixing GLM and Claude means reconfiguring each time. If you want to run GLM most of the time and jump to Claude (or a local model) on demand, use an agent where the provider, base URL, key and model are settings you pick from a list.

What that looks like with Wuwei

GLM in the model list

Pick it in the UI; Claude, Kimi, DeepSeek, Qwen and OpenAI-compatible endpoints sit alongside.

One-click switch

Move between GLM and Claude mid-task without editing config or restarting.

Free, open source, local

MIT-licensed, runs on your machine, reads your real files; you only pay Zhipu's usage.

FAQ

Can Claude Code use GLM?

Yes. Zhipu exposes an Anthropic-compatible endpoint for GLM. Set ANTHROPIC_BASE_URL to https://open.bigmodel.cn/api/anthropic and ANTHROPIC_AUTH_TOKEN to your Zhipu key, then select a GLM model such as glm-4.7 or glm-5.2 — no proxy needed.

What is GLM-5.2 and is it good for coding?

GLM-5.2 is Zhipu's newer flagship line, a popular value pick for agent coding with strong capability per dollar and a large-context (1M) variant that helps on bigger repos.

How do I switch between GLM and Claude easily?

Use an agent where the model is a setting. Wuwei is free and open source — GLM and Claude are both in the model list, so switching is one click rather than an env-var edit and restart.

If you want agent coding on GLM's cheap, long-context models — with Claude a click away when you need it — Wuwei is a free, open-source agent that puts both in one model list. Bring your Zhipu key, pick GLM, and run locally on your real files.

Windows · macOS · Linux · free, no login