GLM-5.4 API Access: Coding Plan Setup, Context, and Quotas
Configure GLM-5.4 in Claude Code and Cline while Z.ai's standard API awaits safety evaluation. Compare Coding Plan with a separately billed gateway route, set a 512000 client window, control marathon thinking, and understand the 1.5× quota, key types, and optional Team overage.
Contents

The official standard GLM-5.4 API still awaits safety evaluation as of 2026-11-24, according to the release notice. Claude Code and Cline users can already use Coding Plan, but that subscription does not authorize an application backend. For coding, use a plan-specific key, start with 512000 context settings, and choose effort explicitly rather than accepting maximum reasoning.
Which GLM-5.4 route should you use?
| Route | Requirements and billing | Choose it when |
|---|---|---|
| Official Coding Plan | Your own Z.ai account, an active subscription, a payment option accepted at checkout, a dedicated plan key, and a supported tool. Usage consumes plan credits. | You want GLM-5.4 inside Claude Code or Cline now. |
| Wait for a quota reset | An existing subscription. Check the 5-hour limit and any weekly limit your plan has; waiting requires no extra purchase. | The limit is occasional and you can postpone the task. |
| BetterToken | Your own account and API key, a payment option offered in its console, and separate token-based billing. Its catalog lists glm-5.4 for Chat Completions. | You want to test pay-as-you-go access instead of consuming Coding Plan quota. |
| Z.ai standard API | Standard API credentials and separate API billing once GLM-5.4 opens. The notice specifies safety evaluation, not a launch date. | Your application needs the vendor’s standard API. Keep an already available model until then. |
Try the BetterToken route in Cline
As of 2026-11-24, BetterToken lists glm-5.4 for OpenAI-compatible Chat Completions. Messages and Responses support for this model are unverified here. Make a small request before switching a working project.
With VS Code and Cline installed, create your own BetterToken API key in the console. Follow the BetterToken Cline setup: open Cline’s provider settings and select OpenAI Compatible. Set Base URL to https://www.bettertoken.ai/v1, paste the BetterToken key into API Key, and enter glm-5.4 as the model.
Save with Done, restart Cline, and use Verify in provider settings. Send a short prompt such as “Reply with only OK.” A response without authentication or model errors confirms that request worked. Check the matching model, request status, and charge in the console. If verification fails, recheck the key, Base URL, and model before sending repository content.
Check current token prices before a longer task. This is separate OpenAI-compatible API access, not a Z.ai subscription or a bundled coding-tool plan. Do not transfer the official route’s context or vision settings to this endpoint without checking its supported capabilities.
For the vendor’s own route, use an active Coding Plan subscription and its dedicated key. Z.ai documents both Claude Code and Cline. The official setup below is for international Z.ai Coding Plan accounts.
Why set 512000 when the model card says 1M?
The GLM-5.4 model card lists a 1M context window and 128K maximum output. These describe model capacity, not your subscription allowance.
The BigModel Coding Plan FAQ recommends 512000 for coding clients. Z.ai’s English switching guide instead shows 1000000. This guide follows the smaller, explicit Coding Plan recommendation; it does not redefine GLM-5.4 as a 512K model.
In Claude Code, CLAUDE_CODE_AUTO_COMPACT_WINDOW controls when conversation history is compacted, not the model’s advertised capacity. In Cline, set the custom model’s Context Window Size. For broader gateway failures, see Claude Code context-window and unknown-model troubleshooting.
Configure the official Coding Plan route
All Coding Plan tiers support GLM-5.4. Create a personal key through API Keys → Personal Coding Plan, or obtain your assigned team key under Team Coding Plan → My Plan. The key-management guide separates these from standard API keys. Owning a subscription does not make a standard key spend subscription quota.
Claude Code: select the model and compaction window
Use an installed Claude Code CLI. Merge this env block into ~/.claude/settings.json, keeping your other settings. On native Windows, the corresponding file is %USERPROFILE%\.claude\settings.json; the launch example below uses Bash.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "512000",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.4[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.4[1m]",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.4[1m]",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "glm-5.4[1m]"
}
}
These aliases follow BigModel’s GLM-5.4 switching instructions, combined with Z.ai’s international Base URL. The [1m] model suffix and earlier compaction serve different purposes: long-context selection can coexist with a 512000 compaction window.
Remove stale credential overrides from your own settings before launching. A settings-file env value can override the same variable exported by your shell, as explained in Claude Code’s environment reference.
In Bash, from your project directory, enter your Coding Plan key without displaying it:
unset ANTHROPIC_API_KEY
read -rs ANTHROPIC_AUTH_TOKEN && export ANTHROPIC_AUTH_TOKEN
claude --model 'glm-5.4[1m]'
Run /status and confirm that your user settings loaded and the model is glm-5.4 or glm-5.4[1m]. Check /autocompact for the 512000 override. If either value is wrong, inspect the loaded settings before sending a task.
Run /effort and select low for this initial check. Ask it to read one existing source file and explain its main function without editing anything. Approve only the requested read. A successful check produces a file-read result and an answer grounded in that file, with no changes.
Cline: use the coding endpoint and custom model
In Cline’s provider settings, select OpenAI Compatible, following the official Cline configuration. Enter https://api.z.ai/api/coding/paas/v4 as Base URL and your Coding Plan key as API Key. Select a custom model and enter glm-5.4.
Set Context Window Size to 512000 in Model Configuration. Enable Support Images when you need visual input through this official GLM-5.4 route. Start a new task and repeat the read-only check.
Do not substitute a standard API key or endpoint while expecting Coding Plan billing. Confirm the request against your plan’s usage statistics.
What does the 1.5× quota actually mean?
The announcement applies to subscribers with a weekly limit: GLM-5.4 provides 1.5 times the usable allowance of GLM-5.3. ZCode’s FAQ explains this as more usable tokens within the same quota, not 50% more plan credits.
This is not a promise of 1.5 times as many completed tasks. Longer reasoning can consume the additional allowance.
Check your plan’s 5-hour limit and any weekly limit it includes. The usage rules describe credits refreshing five hours after consumption. Where a weekly limit applies, those credits reset every seven days. A 5-hour refresh does not clear an exhausted weekly allowance. The Coding Plan FAQ also confirms that supported tools share the same quota.
For ordinary plan usage, exhausting quota does not automatically draw from account balance or resource packages. Wait for the relevant reset. Team overage is an exception: an administrator can enable separately billed usage beyond the included allowance. Check that setting before promising a team that usage must stop at its quota.
If you see 1113 余额不足 (“insufficient balance”) despite an active plan, check the key and endpoint before adding money. A standard key uses standard billing. A historical Compatible key can also use standard billing at the standard endpoint. The documented remedy is to replace the wrong key with the dedicated plan key. Repeat the small test and inspect plan usage.
Control marathon thinking instead of accepting max
Z.ai says GLM-5.4 reuses 28 layers of the GLM-5 base model for two iterations. This Loop Transformer design adds internal computational depth; it is not a client retry loop you enable.
The model also adds vision, making screenshot-driven coding and tool-assisted 3D or CAD work useful trial tasks. Its direct output is text, not a generated video file. Z.ai acknowledges long “marathon thinking” sequences while reporting benefits from extended reflection.
For its Claude Code integration, Z.ai documents a default of max. Start with low for a bounded edit or connection check. Try high for a difficult bug, and reserve max for work where deeper reasoning justifies more waiting and quota.
The documented GLM mapping groups medium and high into high, and xhigh, max, and ultra into max. With no conflicting effort override, disabling thinking maps to low rather than eliminating reasoning. These are Coding Plan mappings, not verified controls for another provider’s endpoint.
Use /effort to change the requested level and /effort status to inspect it, following Claude Code’s model controls. Run the same bounded task again. If your Cline custom-provider setup exposes no documented effort control, use Claude Code’s documented control rather than assuming Cline requests low effort.
Record elapsed time, quota consumption, and whether the patch passes its relevant test. The cost-per-completed-task approach is more useful for this decision than token-generation speed alone.
Can your application use a Coding Plan key?
No. The official FAQ restricts Coding Plan to supported tools and product environments. It directs self-built applications, websites, bots, and SaaS products to standard API services.
For an application, wait for Z.ai’s standard GLM-5.4 API or validate a separately billed provider route. The release notice gives no launch date; do not treat a gateway listing as Z.ai’s standard-API launch. Before deploying an alternative route, test the exact text, image, and tool-calling operations your application needs.