GLM Coding Plan tutorial
This page takes you from subscribe → first working turn in Claude Code or Cursor. Numbers and allow-lists live on the cheatsheet. Model switch / MCP / errors live in the cookbook.
Official path: Quick Start. Endpoints here are global (api.z.ai). China uses open.bigmodel.cn — see the Chinese tutorial.
1. Confirm you bought the right thing
You bought quota for listed coding tools, not Z.ai chat and not a general API pack.
- The plan is limited to supported tools and products.
- China FAQ (same vendor rule): calling the model from a self-built app, site, bot, or SaaS uses the standard API and does not consume Coding Plan quota.
2. Subscribe and get a plan key
- Open Z.AI Open Platform and sign in.
- Pick a plan on GLM Coding Plan.
- Get a key (Quick Start):
- Individual: Individual Coding Plan > Plan Overview
- Team: Team Coding Plan > My Plan
The Team Plan key is not interchangeable with other Z.AI API keys. Use the Team Plan key if you want Team quota.
Do not commit the key.
3. Preferred path: Coding Tool Helper
Official page: Coding Tool Helper. Prerequisite: Node.js >= v18.0.0.
Helper currently auto-manages only:
- Claude Code
- OpenCode
- Crush
- Factory Droid
Cursor, Cline, TRAE, and the rest of the allow-list are not on that list. Skip to section 5 for Cursor.
Method 1 (official recommended: npx)
npx @z_ai/coding-helperMethod 2: global install
npm install -g @z_ai/coding-helper
coding-helperThe binary is also chelper. If npm install hits permission denied, the official example is sudo npm install -g @z_ai/coding-helper, or go back to npx.
Wizard order (official): UI language → coding plan → API key → tools to manage → auto-install if needed → tool menu → load plan → optional MCP → launch.
Non-interactive commands are on the cheatsheet. Global auth:
coding-helper auth glm_coding_plan_global <token>If anything fails:
coding-helper doctor4. Wire Claude Code
Official page: devpack/tool/claude.
Prerequisites: Node.js 18+. Windows also needs Git for Windows. macOS: prefer nvm.
npm install -g @anthropic-ai/claude-code
cd your-awesome-projectDo not treat a bare claude launch as “done” until the plan env is set.
4.1 Helper (preferred)
npx @z_ai/coding-helperChoose Claude Code and load the plan.
4.2 Install script (macOS / Linux only)
curl -O "https://cdn.bigmodel.cn/install/claude_code_zai_env.sh" && bash ./claude_code_zai_env.shThe script writes ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_zai_api_key",
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"API_TIMEOUT_MS": "3000000"
}
}4.3 Manual settings.json (macOS / Linux / Windows)
Official global example (includes model mapping — this page still shows GLM-5.2; current plan-wide default is GLM-5.3 on Overview. Prefer latest-model when you switch):
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_zai_api_key",
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.2[1m]",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.2[1m]",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1,
"API_TIMEOUT_MS": "3000000"
}
}Open a new terminal:
cd your-project-directory
claudeIf asked “Do you want to use this API key,” choose Yes. Official note: they verified Claude Code 2.0.14 and similar. Upgrade with claude --version and claude update.
The tool page still documents default Opus/Sonnet/Haiku → GLM-4.7. Overview says all plans now serve GLM-5.3. Do not invent a third mapping. To switch, copy latest-model (China mirror of the same guide: latest-model uses glm-5.3[1m]).
5. Wire Cursor
Official page: devpack/tool/cursor. Helper does not configure Cursor.
Custom configuration is only supported in Cursor Pro and higher.
You must use the dedicated Coding API https://api.z.ai/api/coding/paas/v4, not the General API https://api.z.ai/api/paas/v4.
- Install Cursor from the Cursor site.
- Models → Add Custom Model.
- Select the OpenAI Protocol.
- Paste your Z.AI plan key.
- Override OpenAI Base URL →
https://api.z.ai/api/coding/paas/v4. - Enter the model in uppercase. The Cursor page examples are
GLM-4.7andGLM-4.5-air. “The model name must be entered in uppercase, such asGLM-4.7.”
This handbook does not invent a GLM-5.3 Cursor spelling. Overview lists GLM-5.3 as the current plan model; the Cursor page examples lag. Use the string that page shows, or the uppercase form of a model the Overview still lists.
Save, then pick the new provider on the home screen.
6. First prompts
From Quick Start:
Please create a React component containing a user login formMy API request returns a 404 error. Please help me check the code.This function performs poorly. Please optimize it for me.Next: model switch, MCP, and failures → cookbook.