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.2 line even offers a very large (1M) context variant for big codebases.
The config
What to set
- ANTHROPIC_BASE_URLPoint it at Zhipu's Anthropic-compatible base: https://open.bigmodel.cn/api/anthropic
- ANTHROPIC_AUTH_TOKENYour Zhipu (BigModel) API key — usage billed to your Zhipu account.
- 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)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.