DevTk.AI
GLM-5.3Claude CodeZ.AIZhipuAI Coding Agent

How to Use GLM-5.3 in Claude Code (Official Z.AI Setup, 2026)

Run Claude Code on GLM-5.3 and GLM-5.3 Flash with Z.AI's official Anthropic-compatible endpoint. Exact settings.json, which API key to use (pay-as-you-go vs GLM Coding Plan), and worked cost math against Claude Opus 5.5.

By Published 6 min read

Z.AI (Zhipu) documents how to run Claude Code on GLM-5.3 through its Anthropic-compatible endpoint. You can pay per token with a standard API key, or use a GLM Coding Plan subscription key. The settings are the same; the key decides how you’re billed.

Everything below follows Z.AI’s Claude Code guide, model switching guide and API key management guide, checked on 2026-11-16. Prices come from Z.AI’s pricing page and Anthropic’s pricing page as recorded in DevTk.AI’s model data.

Who supports this: Z.AI documents and supports this setup. Anthropic’s Claude Code docs say Anthropic doesn’t support routing Claude Code to non-Claude models.

Quick answer

SettingValue
Endpoint (Z.AI, international)https://api.z.ai/api/anthropic
Endpoint (BigModel, mainland China)https://open.bigmodel.cn/api/anthropic, per Zhipu’s Chinese guide
Opus and Sonnet tiersglm-5.3[1m]
Haiku tierglm-5.3-flash[1m]
Where to put itthe env block of ~/.claude/settings.json
BillingDecided by the key type (see below)

Step 1: pick the right API key

Since 2026-10-16, Z.AI manages keys for the standard API and for the GLM Coding Plan separately, and for keys created from that date the key type decides billing, whatever endpoint you call:

You wantKey typeBilling
Pay per tokenStandard API keyYour account balance or usage bundles; doesn’t use Coding Plan quota
Use your GLM Coding PlanPersonal Coding Plan keyYour plan’s 5-hour and weekly quota
Use a team planTeam Plan keyTeam plan and seat rules

Z.AI’s example: a standard key used in a coding tool bills pay-as-you-go even if you also have a Coding Plan. Keys created before 2026-10-16 were classified automatically; check the label in the Z.AI console if you’re unsure.

Step 2: install Claude Code

npm install -g @anthropic-ai/claude-code
cd your-project
claude

Z.AI lists Node.js 18 or newer, and Git for Windows on Windows.

Step 3: configure settings.json

Z.AI’s manual configuration (add or update these keys in ~/.claude/settings.json; don’t replace other fields):

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your_zai_api_key",
    "ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.3-flash[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.3[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.3[1m]",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1,
    "DISABLE_TELEMETRY": "1",
    "CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT": "0",
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1000000",
    "API_TIMEOUT_MS": "3000000"
  }
}

Open a new terminal, run claude in your project, and answer Yes if Claude Code asks “Do you want to use this API key”. The file holds your key in plain text; don’t commit it.

To run everything on the cheaper Flash model, Z.AI’s switching guide sets all three tiers to glm-5.3-flash[1m].

Z.AI also offers a setup helper (npx @z_ai/coding-helper) and a macOS/Linux script that write the same file. The manual version above shows exactly what changes.

What changes on GLM-5.3

AreaWhat happens
Your Claude planWith a Z.AI key in ANTHROPIC_AUTH_TOKEN, Claude Pro/Max/Ultra limits aren’t used.
ReasoningGLM-5.3 always reasons, with low, high and max effort levels.
TelemetryZ.AI’s config turns off Claude Code’s non-essential traffic and telemetry.
Coding Plan toolsZ.AI says the GLM Coding Plan may only be used in its officially supported tools. Claude Code is one of them.

Cost: pay-as-you-go

Claude Code defaults to Claude Opus 5.5 on paid plans and the API, per Anthropic’s model configuration docs.

Assumed workload: 100M input tokens and 2M output tokens a month, 90% of input as cache hits (90M cached, 10M uncached), all on the Opus/Sonnet tier. Anthropic’s cache-write premium is left out.

ModelUncached inputCached inputOutputMonthly total
Claude Opus 5.510M × $4.00 = $40.0090M × $0.20 = $18.002M × $20.00 = $40.00$98.00
Claude Sonnet 5.510M × $2.00 = $20.0090M × $0.10 = $9.002M × $10.00 = $20.00$49.00
GLM-5.310M × $1.40 = $14.0090M × $0.26 = $23.402M × $4.40 = $8.80$46.20
GLM-5.3 Flash10M × $0.15 = $1.5090M × $0.03 = $2.702M × $0.50 = $1.00$5.20

At pay-as-you-go rates GLM-5.3 costs a bit under half of Opus 5.5 on this workload, but about the same as Sonnet 5.5, because its cached-input price ($0.26/M) is higher than Sonnet’s ($0.10/M) and cache reads dominate agent traffic. GLM-5.3 Flash is the cheap option at about 5% of Opus.

Cost: GLM Coding Plan credits

Z.AI publishes how the GLM Coding Plan meters usage, which lets you estimate whether a workload fits:

  • Credits used = (input tokens × input multiplier + cached tokens × cached multiplier + output tokens × output multiplier) / 10,000.
  • GLM-5.3 multipliers: 6.9 input, 1.7 cached input, 24 output. GLM-5.3 Flash: 2.3, 0.56, 8.
  • Off-peak usage costs 50% of the standard credit rate. Peak is Monday to Friday, 14:00-18:00 Singapore time (UTC+8).
Plan5-hour creditsWeekly credits
Lite2,00010,000
Pro12,00060,000
Max28,000140,000

The same workload on GLM-5.3, all at the peak rate:

  • Uncached input: 10,000,000 × 6.9 / 10,000 = 6,900 credits
  • Cached input: 90,000,000 × 1.7 / 10,000 = 15,300 credits
  • Output: 2,000,000 × 24 / 10,000 = 4,800 credits
  • Total: 27,000 credits a month, about 6,200 a week over 4.33 weeks.

That fits under Lite’s 10,000 weekly credits if spread evenly, and off-peak use would halve it. The 2,000-credit 5-hour cap on Lite is the tighter limit for bursty sessions. Z.AI’s docs say plans start at $18 a month but don’t list the Pro and Max prices; check the subscription page before you buy.

Troubleshooting

SymptomFix
Settings don’t take effectClose all Claude Code windows and open a new terminal; check the JSON is valid
Plan quota not usedYou may be using a standard key; create a Coding Plan key under Personal Coding Plan
Unexpected pay-as-you-go chargesSame cause: the key type, not the endpoint, decides billing
Old model namesRequests for GLM-5.2/5.1 route to GLM-5.3 on the Coding Plan, but set glm-5.3 explicitly

Next step

Related Posts