GLM Coding Plan + MCP: Run GLM 5.4 in Claude Code (2026)
Nikhil Tiwari
MCP Playground
Quick answer
Point Claude Code at Z.ai’s Anthropic-compatible endpoint and map its model slots to GLM 5.4. Add this to ~/.claude/settings.json, with your Coding Plan API key:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_zai_api_key",
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.4[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.4[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.3-flash[1m]",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
"API_TIMEOUT_MS": "3000000"
}
}
MCP servers are added the normal Claude Code way, with claude mcp add. GLM doesn’t change that part.
TL;DR
- All tiers get GLM 5.4. Lite, Pro and Max all include GLM 5.4, GLM 5.3 and GLM 5.3 Flash.
- Set the model names yourself. Z.ai’s setup page still lists GLM 5.3 Flash as the default for every slot. The
[1m]suffix turns on the 1M-token window. - MCP works as usual. Claude Code is the MCP client; GLM only sees the tools as function calls.
- Three Z.ai MCP servers come with the plan: web search, web reader and vision. Each call costs plan credits.
- Watch the thinking. GLM 5.4 defaults to max effort and Z.ai says it can get stuck in long “marathon thinking”. Use
/effortto drop it to high.
The GLM Coding Plan is Z.ai’s subscription for running GLM models inside coding agents like Claude Code. In late November Z.ai put GLM 5.4, its new flagship, on the plan before it reached most other places, so a lot of people are setting it up this week.
Getting Claude Code to talk to GLM takes a few environment variables. Getting your MCP servers to work well with it takes a bit more thought, because GLM 5.4 always reasons, defaults to max effort, and every tool call counts against your plan.
Everything below was checked against Z.ai’s Claude Code guide, its GLM 5.4 upgrade page and the Claude Code MCP docs on 2 December 2026. If you’re new to MCP itself, what the Model Context Protocol is is a better place to start.
What does the GLM Coding Plan include?
It’s a monthly plan, starting at $18 according to Z.ai’s overview page, that gives you a credit allowance instead of pay-per-token billing. Credits refill every five hours, with a weekly cap on top.
| Tier | Credits per 5 hours | Credits per week |
|---|---|---|
| Lite | 2,000 | 10,000 |
| Pro | 12,000 | 60,000 |
| Max | 28,000 | 140,000 |
Every tier can use GLM 5.4, GLM 5.3 and GLM 5.3 Flash. Usage outside peak hours (peak is 14:00–18:00 Singapore time, Monday to Friday) is charged at half rate.
When the credits run out, calls stop until the next five-hour window. The plan doesn’t fall back to your pay-as-you-go balance, which matters if an agent is halfway through a long task.
GLM 5.4 is the first flagship GLM that reads images and video, and the first built as a Loop Transformer, which runs some of its layers twice per token. The GLM 5.4 model page has the specs and what Z.ai has published so far.
How do you set up Claude Code with the GLM Coding Plan?
1. Install Claude Code
npm install -g @anthropic-ai/claude-code
Z.ai lists Node.js 18 or newer as the requirement.
2. Point it at Z.ai
Claude Code reads environment variables from the env block of ~/.claude/settings.json. Two of them do the switch:
ANTHROPIC_BASE_URLset tohttps://api.z.ai/api/anthropicANTHROPIC_AUTH_TOKENset to your Coding Plan API key. Note it’sAUTH_TOKEN, notANTHROPIC_API_KEY.
Z.ai also offers a helper, npx @z_ai/coding-helper, and a macOS/Linux script that writes these two values for you. Neither sets the model names, so you still need step 3.
3. Map the model slots to GLM 5.4
Claude Code asks for models by slot (Opus, Sonnet, Haiku), and Z.ai routes each slot to a GLM model. The default mapping on Z.ai’s setup page still sends every slot to GLM 5.3 Flash, so set them explicitly:
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.4[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.4[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.3-flash[1m]",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000"
The [1m] suffix gives you the 1M-token window, and the compact setting stops Claude Code from compacting the conversation at its usual smaller limit. Z.ai’s upgrade page maps Haiku to GLM 5.4 too. I’d keep Flash there, since Claude Code uses that slot for small background jobs.
Z.ai’s full example also sets API_TIMEOUT_MS to 3000000, which is 50 minutes. Keep it. A long reasoning pass at max effort can outlast Claude Code’s default timeout.
4. Check it worked
Start claude and run /status. The model should show as glm-5.4 or glm-5.4[1m]. If Claude Code says the model doesn’t exist, update Claude Code; older versions reject the suffix.
How do you add MCP servers to Claude Code on the GLM Coding Plan?
Exactly as you would on Claude. MCP runs between Claude Code and your servers. The model only sees a list of tools and returns tool calls, so swapping in GLM doesn’t change any MCP config.
A remote server over streamable HTTP:
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
A local stdio server:
claude mcp add context7 -- npx -y @upstash/context7-mcp
Add -s user to make a server available in every project, or -s project to write it to a .mcp.json you can commit. Inside a session, /mcp shows which servers connected and lets you sign in to OAuth servers.
If you already have servers set up for Claude, they keep working after the switch. The Claude Code MCP setup guide covers scopes, OAuth and good servers to start with.
Which MCP servers does Z.ai include with the Coding Plan?
Z.ai runs a few MCP servers of its own for plan subscribers, all billed from the same credit allowance.
| Server | Transport | Tools |
|---|---|---|
| Web Search | Remote HTTP | webSearchPrime |
| Web Reader | Remote HTTP | webReader |
| Vision | Local stdio (Node 22+) | Screenshot text, error screenshots, diagrams, charts, UI diffs, images, short videos |
The commands, from Z.ai’s docs:
# Web search
claude mcp add -s user -t http web-search-prime \
https://api.z.ai/api/mcp/web_search_prime/mcp \
--header "Authorization: Bearer your_api_key"
# Web reader
claude mcp add -s user -t http web-reader \
https://api.z.ai/api/mcp/web_reader/mcp \
--header "Authorization: Bearer your_api_key"
# Vision
claude mcp add -s user zai-mcp-server \
--env Z_AI_API_KEY=your_api_key Z_AI_MODE=ZAI \
-- npx -y "@z_ai/mcp-server"
With GLM 5.4 reading images natively, you may not need the vision server for screenshots you paste in. It is still useful for video files and for comparing two UI screenshots.
Test your MCP server on GLM 5.4 before Claude Code uses it
When a tool call fails inside Claude Code, it’s hard to tell who caused it. It could be the server, the tool schema, the model, or Claude Code’s own prompt around the model.
I take the client out of the picture first. In MCP Agent Studio, paste the server URL, pick GLM 5.4, and ask for the task you want Claude Code to do. Every tool call, argument and result is shown, so a wrong argument is obvious.
Run GLM 5.4 against your own MCP server in the browser, with no Z.ai key: Test any MCP server free →
Run the same prompt on GLM 5.3 as well. Z.ai’s only published flagship comparison is a 51% win rate for 5.4 over 5.3, so your own tools are the real test. If 5.3 gets the arguments right and 5.4 doesn’t, keep the Sonnet slot on 5.3 for that project.
For stdio servers on your own machine, the desktop app does the same against local processes. The GLM testing guide has the results of my earlier runs on GLM 5.3 and 5.2.
How do you stop GLM 5.4 marathon thinking?
GLM 5.4 always reasons, and its default effort is max. Z.ai’s own model page lists a limitation: the model “tends to get caught in overly long ‘marathon thinking’ loops”.
With MCP this adds up quickly. A ten-step task means ten reasoning passes, and each pass at max effort can run for minutes before the next tool call goes out.
Claude Code’s /effort command sets the level. Z.ai maps what Claude Code sends to three GLM levels:
| You set | GLM 5.4 uses |
|---|---|
| Nothing, or thinking on | max (default) |
| medium or high | high |
| low, or thinking off | low (still thinks briefly) |
Z.ai recommends max for coding. My rule is simpler: keep max for planning and hard debugging, and drop to high for tool-heavy work like searching docs, reading tickets or running a test suite. Those steps rarely need a long think, and they are where loops waste the most quota.
If a session sits thinking for several minutes without a tool call, interrupt it with Esc, set /effort high, and ask it to continue. You keep the context and lose only the stuck pass.
How does MCP use eat GLM Coding Plan quota?
Usage for both models and MCP tools is counted in plan credits. Two things matter:
- Z.ai’s own MCP servers cost 1.2 credits per call for search and reader. Vision is billed as GLM 5.3 Flash tokens.
- Every tool result becomes input tokens. A server that returns a whole web page or a 500-row query result is billed on every later turn that still has it in context.
GLM 5.4 is cheaper per token on the plan than GLM 5.3. Z.ai’s multipliers are 4.6 input and 16 output for 5.4, against 6.9 and 24 for 5.3, and weekly-quota users get 1.5× more GLM 5.4 usage than 5.3. Long thinking eats into that saving, since reasoning counts as output.
Servers that let you filter or page their results save more quota than any model setting. If yours can’t, that is worth fixing on the server side.
Troubleshooting
- “Model does not exist”. Update Claude Code. Z.ai verified the setup on version 2.0.14, and the
[1m]suffix needs a recent build. - Still running GLM 5.3 Flash. The model variables aren’t set, or are set differently somewhere else, such as your shell profile. Check
/status. - 401 from Z.ai. Check the key is in
ANTHROPIC_AUTH_TOKEN, notANTHROPIC_API_KEY, and that it’s the key from your Coding Plan account. - Local MCP server won’t start. This is a Claude Code and PATH problem, not a GLM one. See fixing spawn npx ENOENT.
- Server connects but tools are missing. See MCP server connected but no tools showing.
- Requests time out mid-task. Set
API_TIMEOUT_MSto3000000as Z.ai suggests, and lower the effort.
FAQ
Does the GLM Coding Plan work with Claude Code?
ANTHROPIC_BASE_URL to Z.ai’s Anthropic-compatible endpoint and ANTHROPIC_AUTH_TOKEN to your plan key, then map the model slots to GLM models.Is GLM 5.4 on the Lite plan?
Do MCP servers work with the GLM Coding Plan?
claude mcp add works the same on GLM. Z.ai also includes web search, web reader and vision MCP servers with the plan.Can I turn off thinking on GLM 5.4?
/effort in Claude Code to choose low, high or max.What does [1m] mean in the model name?
Can I test GLM 5.4 on my MCP server without a Coding Plan?
Summary
Five environment variables move Claude Code onto the GLM Coding Plan, and MCP servers carry over unchanged. Set the model names yourself, keep the long timeout, and use /effort high for tool-heavy sessions so marathon thinking doesn’t burn the five-hour allowance.
Before you trust GLM 5.4 with a server in Claude Code, run the server against it once where you can see every call. Test your MCP server free →
Related
Written by Nikhil Tiwari
15+ years in product development. AI enthusiast building developer tools that make complex technologies accessible to everyone.
Free MCP Tools (no install)
Build, compare & ship MCP agents
Connect any MCP server, run evals on it, compare 90+ models side-by-side, deploy hosted servers, and save reusable agents you can export as an API — all in your browser.