Claude Code + GLM: the GLM Coding Plan, setup and where your code goes
14 min read
Run Claude Code on Z.ai's GLM models: the GLM Coding Plan, base URL and settings from Z.ai's docs, what breaks, where prompts go and the open-weight path.
Claude Code runs on Z.ai's GLM models through Z.ai's Anthropic-compatible endpoint at https://api.z.ai/api/anthropic. Subscribe to the GLM Coding Plan, create a plan API key, and put the base URL, the key and the GLM model names in ~/.claude/settings.json.
As of 15 November 2026 the plan serves GLM-5.3 and GLM-5.3-Flash, both with a 1M-token context window, from $18 a month. Z.ai is operated from Singapore by Jingsheng Hengxing Technology Pte. Ltd. Zhipu's mainland China platform publishes the same setup with its own endpoint and its own privacy policy. This guide gives the setup from Z.ai's docs, how to check which model answered, what does not work, what the terms say about your prompts, the open-weight path on your own hardware, and the same setup for a team.
What you need
Value on 15 November 2026 | |
|---|---|
Claude Code | Z.ai recommends the latest version and says it has verified 2.0.14 and other versions |
Subscription | GLM Coding Plan: Lite, Pro or Max, from $18 a month. Or a Team Plan with at least two seats |
API key | A Coding Plan key or a Team Plan key. Since 16 October 2026 these are separate from Standard API keys and not interchangeable |
Base URL |
|
Models |
|
Context and output | 1M tokens of context. GLM-5.3 outputs up to 128K tokens |
Individual quota | Lite 2,000 credits per 5 hours and 10,000 per week. Pro 12,000 and 60,000. Max 28,000 and 140,000 |
Team quota per seat | Standard 15,000 credits per 5 hours and 66,000 per week. Premium 35,000 and 155,000 |
Pay-as-you-go price per 1M tokens | GLM-5.3: input $1.40, cached input $0.26, output $4.40. GLM-5.3-Flash: $0.15, $0.03, $0.50 |
Anthropic account | Not needed for model requests |
Credits are counted from tokens, and GLM-5.3 uses three times the credits of GLM-5.3-Flash for the same tokens. Outside peak hours usage costs half the credits. Peak is Monday to Friday, 14:00 to 18:00 Singapore time, which is 06:00 to 10:00 UTC.
Requests for older names are redirected: GLM-5.2 and GLM-5.1 go to GLM-5.3, and GLM-4.7 goes to GLM-5.3-Flash. A guide that tells you to set glm-4.6 or glm-4.7 is out of date.
Step 1: install Claude Code
macOS, Linux and WSL:
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
Z.ai's guide uses npm:
npm install -g @anthropic-ai/claude-code
Z.ai asks for Node.js 18 or newer. Anthropic's setup page says the npm package needs Node.js 22 or later, so use 22.
Step 2: subscribe and create a plan key
Register on the Z.ai Open Platform and subscribe to the GLM Coding Plan. Then create the key in the right place:
Individual Plan: Personal Coding Plan, Plan Overview.
Team Plan: Team Coding Plan, My Plan. Each member gets their own key after accepting a seat.
The key type decides how a call is billed. A Standard API key used in Claude Code does not draw on the plan quota and is charged pay-as-you-go against the account balance.
Step 3: configure Claude Code
Z.ai gives three ways. Use one.
The helper. It installs tools, loads the plan and manages MCP servers:
npx @z_ai/coding-helper
The script. macOS and Linux only. It is downloaded from cdn.bigmodel.cn, Zhipu's domain, and edits ~/.claude/settings.json for you:
curl -O "https://cdn.bigmodel.cn/install/claude_code_zai_env.sh" && bash ./claude_code_zai_env.sh
It writes three variables: ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL and API_TIMEOUT_MS. With no model variables set, Z.ai maps the opus, sonnet and haiku aliases to GLM-5.3-Flash.
By hand. Edit ~/.claude/settings.json and replace your_zai_api_key:
{ "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" }}
What the lines do:
ANTHROPIC_BASE_URLandANTHROPIC_AUTH_TOKENsend model requests to Z.ai with the plan key as a bearer token.The three
ANTHROPIC_DEFAULT_*_MODELlines put GLM-5.3 on theopusandsonnetaliases and GLM-5.3-Flash onhaiku, which also runs Claude Code's background tasks.The
[1m]suffix, withCLAUDE_CODE_AUTO_COMPACT_WINDOWandCLAUDE_CODE_MAX_CONTEXT_TOKENSat 1,000,000, turns on the 1M window. If Claude Code says a[1m]model does not exist, update Claude Code.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICandDISABLE_TELEMETRYturn off auto-updates, telemetry, error reporting and feature-flag fetching.CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=0keeps Claude Code's full system prompt.API_TIMEOUT_MS=3000000gives each request 50 minutes to return its response headers.
Step 4: start Claude Code
Open a new terminal so the settings are read, then:
cd your-project-directoryclaude
If Claude Code asks "Do you want to use this API key", select Yes. Then trust the folder.
Step 5: choose the model and the effort
To run everything on the cheaper model, set all three aliases to Flash. Add or update only these keys:
{ "env": { "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.3-flash[1m]", "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.3-flash[1m]", "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.3-flash[1m]" }}
GLM-5.3 always reasons and has three effort levels: low, high and max. Type /effort in a session to change it. Z.ai converts Claude Code's levels: medium and high become high, xhigh and max become max, and turning thinking off becomes low. The default is max.
Step 6: check which model answered
Run claude, then type:
/status
Z.ai tells you to verify two lines: Settings source shows your ~/.claude/settings.json, and Model shows glm-5.3 or glm-5.3-flash, with or without [1m]. The base URL line should show https://api.z.ai/api/anthropic.
For a second check outside Claude Code, open the Charge Type page in the Z.ai console after a session. It shows the tokens consumed per pricing type and the number of tool calls.
Do not test a plan key with curl. The subscription terms limit plan quota to supported tools and exclude calling the model API directly.
To go back to Anthropic, remove the env entries, open a new terminal and sign in again.
What works and what does not on GLM
Works: chat, reading and editing files, running commands, the agent loop, subagents, the 1M window and /effort. Z.ai lists Claude Code as an officially supported tool for the plan.
Does not work, or works differently:
Anthropic does not support it. Anthropic's documentation says it "doesn't support routing Claude Code to non-Claude models through any gateway".
GLM-5.3 is text only. For screenshots and diagrams use GLM-5.3-Flash, or Z.ai's Vision MCP Server, which is included in the plan.
Web search comes from Z.ai's MCP servers. The plan includes Web Search, Web Reader and Zread MCP servers. Each call costs 1.2 credits.
Quota runs out in two ways. There is a 5-hour limit and a weekly limit. On an individual plan, when either is used up you wait for the reset; the account balance is not used. A Team Plan administrator can switch on paid overage.
Thinking cannot be switched off. A request that disables thinking is run at low effort.
Peak hours cost double the credits. Concurrency follows the plan tier: Max above Pro above Lite.
Claude.ai features are off. Connectors from claude.ai need a claude.ai login, and Remote Control is disabled whenever
ANTHROPIC_BASE_URLpoints at a host other thanapi.anthropic.com. Z.ai's settings also turn off feature-flag fetching, which Remote Control needs.Individual plans are for one person. The subscription terms license an individual plan "only to the individual natural person" on the account. Sharing a key with colleagues can lead to rate limits or a frozen account. Teams need the Team Plan.
Where Z.ai hosts the API and what it does with prompts
These are the statements in the vendor's own documents, read on 15 November 2026. There are two platforms.
Question | Z.ai ( | Zhipu BigModel ( |
|---|---|---|
Who operates it | Jingsheng Hengxing Technology Pte. Ltd., 10 Anson Road, Singapore | Beijing Zhipu Huazhang Technology Co., Ltd. |
Where data is processed | "We generally provide the Services from Singapore", so data "is generally processed in Singapore". It may be transferred to group companies or third parties overseas | Personal information collected in China is stored in China. The policy says there is no cross-border transfer at present |
Governing law | Singapore, with arbitration at the Singapore International Arbitration Centre | Courts of Haidian District, Beijing |
Policy date | Privacy Policy 29 September 2025; Terms of Use 14 April 2026 | Privacy policy effective 20 May 2025 |
What Z.ai says it does with content depends on which kind of customer you are:
Individual users. The Terms of Use say "we reserve the right to process any User Content to improve our existing Services and/or to develop new products and services". The same section grants Z.ai a perpetual, worldwide licence to User Content.
Enterprises and developers on the API. "We will not use your User Content for developing or improving Services unless you explicitly agree." The Data Processing Addendum adds that Z.ai does "not store any of the content the Customer or its End Users provide or generate"; it is "processed in real-time" and "not saved on our servers".
Team Plan. Z.ai's Team Plan page lists "Data is not used for model training by default" as a Team Plan capability.
The pages we read do not say which of these applies to an individual GLM Coding Plan subscriber. The plan is licensed to a natural person and the training exclusion is listed only for the Team Plan. Ask Z.ai in writing before an individual plan is used on company code.
Z.ai may disclose data to a "competent law enforcement body, regulatory, government agency, court or other third party" where it believes that is required by law.
The alternative: GLM open weights on your own hardware
Z.ai publishes GLM weights on Hugging Face. Running them yourself means Z.ai's API is not involved and the terms above do not apply to your prompts. The sizes below were read on 15 November 2026.
Model | Where | Size on disk | Licence and notes |
|---|---|---|---|
GLM-5.3 | Hugging Face, | 756 GB of weights | GLM-5.3 License: MIT-style, with a security review for model-as-a-service businesses above $10 billion in revenue. Text only |
GLM-5.3-Flash | Hugging Face, | 328 GB of weights | MIT. 320B parameters, 18B active. Text and images |
GLM-5.3-Flash GGUF | Hugging Face, | 93 GB to 642 GB by quantisation; Unsloth states 128 GB of memory for the 3-bit build | Not a Z.ai release |
GLM-4.7-Flash | Hugging Face, | 62 GB of weights | MIT. A 30B model with 3B active parameters |
| Ollama library | 19 GB default, 32 GB at q8, 60 GB at bf16. 198K context | Tagged tools and thinking. Needs Ollama 0.14.3 or later |
GLM-5.3 and GLM-5.3-Flash are served with vLLM or SGLang on data-centre GPUs. GLM-4.7-Flash is the one that fits a workstation. Ollama's page for it gives the Claude Code command:
ollama launch claude --model glm-4.7-flash
That model is an older generation than the one the plan serves, so test tool calls on a real edit before you rely on it. glm-5.3:cloud and glm-5.3-flash:cloud in the Ollama library run on Ollama's servers and have no downloadable tag. The full local setup is in our guide to Claude Code with Ollama.
The same models for a team with Aventail™ Connect
The steps above put a plan key in each developer's settings file, where a developer can edit it. A security lead has no record of which machine sent which request where.
Aventail™ Connect configures Claude Code to send its model requests through Aventail™ Link, the inference engine and gateway that runs on each machine. Routing rules are set in Aventail™ Control and evaluated on the device. For the open-weight path, the docs support this much:
Serve the model in Link. Link runs GGUF language models. Choose one from the Aventail™ Library, or upload a custom GGUF in Control and test it on one device. An accepted upload does not prove the model will run.
Use a server for large models. A model too big for laptops can sit on one internal machine running Link, named in a rule as a network peer. The peer must offer the exact model and have Serve other devices enabled. Peer routing is in beta.
Connect Claude Code. In Link, open Connected apps and choose Connect next to Claude. There is no endpoint or key to enter. Claude Code needs at least 64K context.
Write the rule. Permit only On device, or only the peer. If that destination is unavailable, the request fails with an error and is not sent elsewhere.
Check the record. Send a harmless prompt and confirm the destination in Requests in Control.
Tool calling varies between builds of the same model, so test tool use with harmless code first. Free covers three connected devices. Starter is £50 a month excluding VAT with ten devices included. Routing policies need Control for Enterprise.
Which path to take
GLM Coding Plan by hand | GLM weights on your own machines | Open weights with Aventail™ Connect | |
|---|---|---|---|
Who it suits | One developer, or a team on the Team Plan | A team with hardware and someone to run it | A team whose code must stay on approved machines |
Setup | A settings file per developer | Ollama, vLLM or SGLang, then a base URL per developer | Connect button in Link, rules in Control |
Where prompts are processed | Z.ai's servers, generally in Singapore | Your hardware | Where the routing rule says, evaluated on the device |
Terms that cover your prompts | Z.ai's, under Singapore law | Your own | Your own |
Record of requests | Z.ai console; per-member usage on the Team Plan | Whatever your server logs | Requests view in Control |
If the endpoint is down or quota is used up | Requests fail until the reset | Requests fail | Fails closed, or falls back to an approved destination |
Cost | From $18 a month per person | Hardware and power | Free for three devices; Starter is £50 a month excluding VAT with ten devices |
Frequently asked questions
Can I use GLM in Claude Code?
Yes. Z.ai runs an Anthropic-compatible endpoint at https://api.z.ai/api/anthropic and lists Claude Code as a supported tool for the GLM Coding Plan. Set the base URL, the plan key and the model names in ~/.claude/settings.json.
How much does the GLM Coding Plan cost?
Z.ai's docs say plans start at $18 a month. There are three individual tiers, Lite, Pro and Max, which differ in credits: 10,000, 60,000 and 140,000 a week. Subscriptions renew automatically and are not refundable.
Does the GLM Coding Plan replace a Claude subscription?
It replaces the model behind Claude Code. Requests go to Z.ai and count against the plan quota, and a Claude subscription is not used for them. The answers come from GLM models.
Can a team share one GLM Coding Plan?
No. An individual plan is licensed to one person and account sharing is prohibited. The Team Plan is sold by seat, with a minimum of two, one member per seat.
Does Z.ai train on my code?
It depends on the contract. Z.ai's terms allow it to use individual users' content to improve its services. They say API customers' content is not used unless they agree, and the Team Plan page says data is not used for training by default.
Can I run GLM locally with Claude Code?
Yes. GLM-4.7-Flash is 19 GB in the Ollama library and starts with ollama launch claude --model glm-4.7-flash. GLM-5.3-Flash and GLM-5.3 are 328 GB and 756 GB and need server GPUs.
Which endpoint do I use in mainland China?
Zhipu's BigModel platform publishes the same guide with https://open.bigmodel.cn/api/anthropic as the base URL. It has its own keys, its own operator and its own privacy policy.
Related guides
Sources
Z.ai, Claude Code (GLM Coding Plan): https://docs.z.ai/devpack/tool/claude
Z.ai, GLM Coding Plan quick start: https://docs.z.ai/devpack/quick-start
Z.ai, GLM Coding Plan overview: https://docs.z.ai/devpack/overview
Z.ai, How to Switch Models: https://docs.z.ai/devpack/latest-model
Z.ai, API Key Management Guide (16 October 2026): https://docs.z.ai/devpack/notice/api-key-management
Z.ai, Team Plan Benefits: https://docs.z.ai/devpack/teamplan
Z.ai, Usage Policy and FAQ: https://docs.z.ai/devpack/usage-policy and https://docs.z.ai/devpack/faq
Z.ai, Subscriptions, Fees, and Payment: https://docs.z.ai/legal-agreement/subscription-terms
Z.ai, Pricing: https://docs.z.ai/guides/overview/pricing
Z.ai, GLM-5.3 model guide: https://docs.z.ai/guides/llm/glm-5.3
Z.ai, Vision MCP Server: https://docs.z.ai/devpack/mcp/vision-mcp-server
Z.ai, Privacy Policy and Data Processing Addendum for API Services (29 September 2025): https://docs.z.ai/legal-agreement/privacy-policy
Z.ai, Terms of Use and Additional Terms for API Services (14 April 2026): https://docs.z.ai/legal-agreement/terms-of-use
Zhipu BigModel, Claude Code guide: https://docs.bigmodel.cn/cn/coding-plan/tool/claude
Zhipu BigModel, privacy policy (effective 20 May 2025): https://docs.bigmodel.cn/cn/terms/privacy-policy
Hugging Face, zai-org: GLM-5.3, GLM-5.3-Flash, GLM-4.7-Flash: https://huggingface.co/zai-org
Hugging Face, unsloth/GLM-5.3-Flash-GGUF: https://huggingface.co/unsloth/GLM-5.3-Flash-GGUF
Ollama library: glm-4.7-flash, glm-5.3, glm-5.3-flash: https://ollama.com/library/glm-4.7-flash and https://ollama.com/search?q=glm
Anthropic, Claude Code setup: https://code.claude.com/docs/en/setup
Anthropic, Claude Code environment variables: https://code.claude.com/docs/en/env-vars
Anthropic, Model configuration: https://code.claude.com/docs/en/model-config
Anthropic, Other LLM gateways: https://code.claude.com/docs/en/llm-gateway
Anthropic, Feature availability: https://code.claude.com/docs/en/feature-availability
Aventail™, Connect overview: https://docs.aventail.co.uk/docs/connect/overview
Aventail™, Routing: https://docs.aventail.co.uk/docs/fleet/routing
Aventail™, Compatibility and versions: https://docs.aventail.co.uk/docs/introduction/versions-and-supported-models
Aventail™, Manage models: https://docs.aventail.co.uk/docs/guides/models
Aventail™, Pricing: https://aventail.co.uk/#pricing
All sources were read on 15 November 2026.