How to Use GLM-5.4 in Claude Code, Cline and Other Coding Tools (GLM Coding Plan Setup)

Cover image for How to Use GLM-5.4 in Claude Code, Cline and Other Coding Tools (GLM Coding Plan Setup): Z.ai (official image)

Key facts

Sources checked Nov 23, 2026

  • GLM-5.4 went live on November 23, 2026 for every GLM Coding Plan tier (Lite, Pro and Max). It is not yet on Z.ai’s pay-as-you-go API, so the Coding Plan, ZCode and Z.ai Chat are the only ways in.
  • In Claude Code, point ANTHROPIC_BASE_URL at https://api.z.ai/api/anthropic and set the model aliases to glm-5.4[1m] for the 1M-token context. In other tools the model name is glm-5.4.
  • OpenAI-compatible tools such as Cline use https://api.z.ai/api/coding/paas/v4; Codex uses https://api.z.ai/api/v1.
  • Since October 16, 2026, Coding Plan keys and standard API keys are separate. A standard key in a coding tool bills your balance, not your plan.
  • GLM-5.4 uses fewer plan credits per token than GLM-5.3 (input multiplier 4.6 vs 6.9, output 16 vs 24), which is where the “50% more quota” comes from.

This guide shows how to switch Claude Code, Cline and other coding agents to GLM-5.4 on Z.ai’s GLM Coding Plan, on Windows, macOS and Linux. It’s for people who already have, or are about to buy, a Coding Plan subscription. For what GLM-5.4 is, see our weekly roundup.

Before you start: what you need

GLM-5.4 isn’t a local model. Z.ai hasn’t released weights yet, so this is a cloud setup and your hardware doesn’t matter.

Requirement Details
Subscription An active GLM Coding Plan. Z.ai lists plans from $18 a month.
API key A Coding Plan key, created under Personal Coding Plan (individuals) or Team Coding Plan > My Plan (teams)
Claude Code Node.js 18 or newer for the npm install. On Windows, Git for Windows as well
Other tools Any agent that lets you set a custom base URL and model name

Z.ai’s quick start also says the plan may only be used inside its list of supported tools and products, which includes Claude Code, Cline, Roo Code, Kilo Code, OpenCode, OpenClaw, Crush, Goose and Cursor.

Use the right kind of key

This is the most common billing mistake. Z.ai’s API key guide says that from October 16, 2026, keys for the standard API, Individual Plans and Team Plans are managed separately and are not interchangeable. The key type decides the billing, not the endpoint. If you paste a Standard API key into Claude Code, calls charge your account balance even if you have a subscription. Keys created before October 16 were classified automatically and keep working.

Screenshot of Z.ai: GLM Coding Plan — AI Coding Powered by GLM-5.4 & GLM-5.3-Flash for Age
Screenshot: Z.ai: GLM Coding Plan — AI Coding Powered by GLM-5.4 & GLM-5.3-Flash for Age (official page, captured December 1, 2026).

Step 1: Install Claude Code (skip if you have it)

Z.ai’s Claude Code page uses the npm install:

npm install -g @anthropic-ai/claude-code
claude --version

If you already use Claude Code, update it. Z.ai says that if Claude Code reports that a model with the [1m] suffix doesn’t exist, upgrading fixes it:

claude update

Step 2: Point Claude Code at Z.ai

Claude Code reads its user settings from one file:

OS Path
macOS / Linux / WSL ~/.claude/settings.json
Windows %USERPROFILE%\.claude\settings.json

On Windows, create and open it from PowerShell:

New-Item -ItemType Directory -Force "$env:USERPROFILE\.claude"
notepad "$env:USERPROFILE\.claude\settings.json"

On macOS or Linux:

mkdir -p ~/.claude
${EDITOR:-nano} ~/.claude/settings.json

Add the env block below, with your own Coding Plan key. If the file already has other settings, add or update only these keys. Don’t replace the whole file. This combines the endpoint settings from Z.ai’s Claude Code page with the GLM-5.4 model names from its model-switching guide:

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your_zai_coding_plan_key",
    "ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.4[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.4[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.4[1m]"
  }
}

What each part does:

  • ANTHROPIC_BASE_URL sends Claude Code’s requests to Z.ai’s Anthropic-compatible endpoint.
  • glm-5.4[1m] selects GLM-5.4 with the 1M-token window. Without the [1m] suffix you get the standard window.
  • CLAUDE_CODE_AUTO_COMPACT_WINDOW set to 1000000 tells Claude Code when to compact the conversation. Z.ai says you need both this and the suffix to use 1M context.
  • The three aliases map Claude Code’s Haiku, Sonnet and Opus slots. Z.ai’s own manual example keeps the Haiku slot on glm-5.3-flash[1m], a cheaper model for background tasks. That’s a sensible way to save credits.

Z.ai also offers a helper that configures supported tools for you, if you’d rather not edit JSON:

npx @z_ai/coding-helper

Step 3: Verify the switch

Close every open Claude Code window, open a new terminal, and run:

cd your-project
claude

Inside the session, type /status and check two things:

  1. Settings source shows your settings.json.
  2. Model shows glm-5.4 or glm-5.4[1m].

If Claude Code asks “Do you want to use this API key?”, answer yes.

Step 4: Set thinking effort

GLM-5.4 defaults to its highest thinking level. Type /effort in Claude Code to change it. Z.ai maps the effort values tools send onto three levels:

What the tool sends GLM-5.4 uses
Thinking not set, or enabled / adaptive max (default)
Thinking disabled / off low (still does light thinking)
minimal, light, low low
medium, high high
xhigh, max, ultra max

Z.ai recommends max for coding. Keep in mind that its own blog says GLM-5.4 can fall into “marathon thinking” loops. If a simple edit is taking minutes, try high or low before you blame the setup.

Using GLM-5.4 in Cline and other OpenAI-compatible tools

Pick the endpoint that matches your tool’s protocol. Using the wrong one means calls won’t draw on your plan quota, according to the tool integration page.

Protocol Base URL Used by
Anthropic Messages https://api.z.ai/api/anthropic Claude Code, Goose
OpenAI Chat Completions https://api.z.ai/api/coding/paas/v4 Cline and most OpenAI-compatible agents
OpenAI Responses https://api.z.ai/api/v1 Codex

For Cline, Z.ai’s settings are:

  • API Provider: OpenAI Compatible
  • Base URL: https://api.z.ai/api/coding/paas/v4
  • API Key: your Coding Plan key
  • Model: Custom Model, glm-5.4
  • Support Images: on (GLM-5.4 accepts images)
  • Context Window Size: 1000000

Note the difference: the [1m] suffix is a Claude Code convention. Other tools use the plain name glm-5.4 and set the context window in their own settings.

How GLM-5.4 uses your quota

Each plan has a 5-hour and a weekly credit limit. From Z.ai’s plan overview:

Plan 5-hour credits Weekly credits
Lite 2,000 10,000
Pro 12,000 60,000
Max 28,000 140,000

Credits per call are (input tokens × input multiplier + cached input × cached multiplier + output × output multiplier) / 10,000. The multipliers:

Model Input Cached input Output
GLM-5.4 4.6 1.1 16
GLM-5.3 6.9 1.7 24
GLM-5.3-Flash 2.3 0.56 8

So GLM-5.4 is cheaper per token on the plan than GLM-5.3 (24 ÷ 16 = 1.5×, the advertised 50% more usage). Z.ai also charges 50% of the normal credit rate outside peak hours. Peak is Monday to Friday, 14:00–18:00 Singapore time (UTC+8), which is 10:00 PM to 2:00 AM Pacific time, Sunday through Thursday nights. For most US users, nearly all working hours are off-peak.

Two practical tips. Agents re-send a lot of context, so a high cache hit rate matters: cached input costs about a quarter of fresh input. And long thinking shows up as output tokens, the most expensive multiplier.

Troubleshooting

  • Changes in settings.json do nothing. Close all Claude Code windows and start a new terminal. Check the JSON for missing or extra commas. If it still fails, Z.ai suggests deleting the file and configuring again.
  • “Model glm-5.4[1m] does not exist.” Run claude update.
  • Calls work but your balance drops. You are probably using a Standard API key. Create a key under Personal Coding Plan instead.
  • Calls work but don’t count against the plan. Check that the base URL matches the table above. The general https://api.z.ai/api/paas/v4 endpoint is the standard API, not the Coding Plan endpoint.
  • WSL and Windows both have Claude Code. Each reads its own settings file. Edit the one for the copy you actually launch.
  • Very long, slow answers. Lower /effort, or cap output tokens and turns in your agent.

Bottom line

If you already pay for the GLM Coding Plan, switching to GLM-5.4 is four lines of JSON and a /status check, and it stretches your quota further than GLM-5.3. If you don’t, there’s no pay-as-you-go option yet. Z.ai has published no GLM-5.4 benchmark scores, so test it on your own repo before you move a team over. Our guide to evaluating models on your own tasks works for hosted models too.

Sources: Z.ai GLM-5.4 blog; Z.ai docs: How to Switch Models, Claude Code, Tool Integration, Quick Start, Overview, API Key Management Guide. Not tested on our hardware: we did not have a Coding Plan subscription when writing. Facts checked November 23, 2026.

Cover image: Z.ai (official image)