Setup guide
How to use GLM-5.3 in Claude Code
Point Claude Code at Z.ai's Anthropic-compatible endpoint to run GLM-5.3: the settings to add, how models map, and what stops working when you switch.
· Facts checked October 3, 2026
- Claude Code
The short answer
Claude Code can run GLM-5.3 because Z.ai serves an endpoint that speaks Anthropic's Messages protocol: set ANTHROPIC_BASE_URL to Z.ai's Anthropic endpoint and ANTHROPIC_AUTH_TOKEN to your Z.ai key in Claude Code's settings. Claude Code's plan usage bars, status line limits, and dollar estimates then stop describing what you use, so track GLM usage on Z.ai's side.
At a glance
| Endpoint | ANTHROPIC_BASE_URL set to Z.ai's Anthropic endpoint, api.z.ai/api/anthropic over HTTPS. |
|---|---|
| Key | ANTHROPIC_AUTH_TOKEN set to a Z.ai API key or GLM Coding Plan key. |
| Where | The env block of ~/.claude/settings.json, or Z.ai's coding helper, run with npx @z_ai/coding-helper. |
| Reasoning | /effort maps to GLM's low, high, and max reasoning; max is the default. |
| Not carried over | Claude plan limits, status line rate limits, and Claude Code's dollar estimates. |
Setting it up
Z.ai's guide adds a few variables to the env block of Claude Code's user settings. You can also run Z.ai's coding helper, which writes the same settings for Claude Code, Codex, OpenCode, and other tools. Confirm the result with /status inside Claude Code, which shows the active endpoint.
- Create an API key in Z.ai's console, or use the key that comes with a GLM Coding Plan.
- Open ~/.claude/settings.json and add an env block with ANTHROPIC_AUTH_TOKEN set to the key and ANTHROPIC_BASE_URL set to Z.ai's Anthropic endpoint.
- Add API_TIMEOUT_MS with a long timeout, as Z.ai's example does, so long reasoning turns are not cut off.
- Optionally map the model slots: Z.ai's example sets the Opus and Sonnet slots to glm-5.3[1m] and the Haiku slot to glm-5.3-flash[1m], where the suffix enables the 1M-token context.
- Start a new Claude Code session and run /status to check that requests go to Z.ai.
How Claude Code features map to GLM
Claude Code asks for model tiers by name, and the mapping variables decide which GLM model answers each tier. With Z.ai's example mapping, the main conversation runs on GLM-5.3 and quick background tasks on GLM-5.3-Flash. /effort selects GLM's reasoning level, low, high, or max; turning thinking off maps to low, because GLM-5.3 always reasons.
Some features rely on Anthropic services. Claude Code's built-in web search runs on Anthropic's search backend, so Z.ai offers its own web search, web reader, and vision tools as MCP servers for plan subscribers. GLM-5.3 reads text only, while GLM-5.3-Flash is natively multimodal, so images need the Flash model or Z.ai's vision MCP server.
What happens to usage tracking
Claude Code's usage bars and the rate_limits fields in its status line come from Claude Pro and Max subscriptions, so they disappear when requests go to Z.ai. The session dollar figure in /usage is a local estimate at Anthropic's list prices, which do not apply to GLM. Track plan usage in Z.ai's console instead, as the Coding Plan guide describes.
everyaitoken keeps reading Claude Code's local history, so GLM sessions still show up as tokens by model and project next to your Claude sessions. It does not hold Z.ai prices, so it marks GLM tokens as unpriced rather than pricing them as Claude; for what those tokens cost at Z.ai's API rates, see what GLM-5.3 costs for coding.
Your own numbers
See what your AI coding really costs.
everyaitoken reads Claude Code, Codex, Cursor, OpenRouter, Gemini CLI, and OpenCode on your Mac. It shows limits with reset times, API-equivalent cost, and what caching saved or cost, in the menu bar and 17 widgets. $9 once.
FAQ
Questions
Can Claude Code use GLM-5.3?
Yes. Z.ai serves an Anthropic-compatible endpoint, and setting ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in Claude Code's settings sends requests there. Z.ai lists Claude Code among the supported tools for its Coding Plan.
How do I switch Claude Code back to Claude?
Remove the Z.ai variables from the env block in ~/.claude/settings.json, or from your shell, and start a new session. /status shows which endpoint is active.
Does web search work in Claude Code with GLM?
Claude Code's built-in web search runs on Anthropic's backend. Z.ai provides a web search MCP server for Coding Plan subscribers, which you add with claude mcp add.
Why does /usage show the wrong cost with GLM?
Its session cost is estimated locally at Anthropic's list prices, so it does not reflect GLM's rates or a Z.ai plan. Use Z.ai's console for plan usage.
Sources
Checked October 3, 2026. Plans and limits change; the linked pages are the authority.