DEV Community

Cover image for How to Use the GLM-5.4 API
Hassann
Hassann

Posted on Originally published at apidog.com

How to Use the GLM-5.4 API

GLM-5.4 API: How to Use It Today (Endpoints, Pricing, and Setup)

The GLM-5.4 API is live today only through Z.ai's GLM Coding Plan. Subscribe, create a Coding Plan API key, point your coding agent at https://api.z.ai/api/anthropic (Claude Code) or https://api.z.ai/api/coding/paas/v4 (OpenAI-compatible tools), and set the model to glm-5.4. The pay-as-you-go Model API opens after Z.ai finishes its security assessment, with no date announced yet.

Try Apidog today

Below: what works today, the endpoints and model IDs, credit costs, and how to prep your app so the later switch is one string.

What is GLM-5.4?

GLM-5.4 is Z.ai's flagship model and the first built on a Loop Transformer: it runs 28 layers of the GLM-5 base model twice per token, at roughly 750B parameters. Z.ai says it reaches the level of 2T to 3T parameter models, aimed at "generalized coding": code that builds games, edits video, and drives CAD and 3D work.

GLM-5.4 model overview

In a loop, a block of shared-weight layers runs a second time and refines the first pass, so the network gets deeper without more parameters. Z.ai's GLM-5.4 model page lists these specs:

Spec GLM-5.4
Model ID glm-5.4 (glm-5.4[1m] in Claude Code for 1M context)
Input Video, image, text, file
Output Text
Context length 1M tokens
Max output 128K tokens
Speed Up to 200 tokens/s off-peak, 70 to 80 tokens/s at peak
Features Thinking mode, streaming, function calling, context caching, structured output
Open weights Not released; no date on the model page

Z.ai also names a limitation: the model can fall into long "marathon thinking" loops. The extra reflection tends to raise accuracy, but it costs time, so plan for slower answers on hard prompts.

Can you call the GLM-5.4 API today?

Yes, but only with a Coding Plan key. Z.ai's model page says it directly: "The Model API will be made available upon completion of the security assessment." GLM-5.4 isn't on the pricing page yet, which tops out at GLM-5.3 at $1.40 per 1M input tokens and $4.40 per 1M output tokens.

So you have two routes, and they're not the same thing:

  1. GLM Coding Plan (works now). A subscription that unlocks GLM-5.4, GLM-5.3 and GLM-5.3-Flash inside supported coding tools such as Claude Code, Codex, OpenCode, Cursor, Cline and Kilo Code. Plans start at $18 a month, according to the Coding Plan overview.
  2. Standard Model API (not open for GLM-5.4). Pay-as-you-go keys on https://api.z.ai/api/paas/v4. This is what you'd wire into a production app. Today it serves GLM-5.3 and older.

One rule matters before you get clever. The Coding Plan usage policy says the plan "may only be used within officially supported tools and products," and repeat violations can lead to rate limits, a frozen account, or a ban. Developers have called the Coding Plan endpoints from scripts, and the key does respond, but backing a customer-facing service with a plan key is outside those terms. Use the plan for your own agent work and wait for the Model API for anything you ship.

The three keys are separate too. Z.ai's quick start notes that Personal Plan, Team Plan and standard API keys are "not interchangeable," so a pay-as-you-go key won't unlock GLM-5.4 and a plan key won't bill against your API balance.

Diagram of GLM-5.4 access paths

GLM-5.4 API endpoints and model ID

The Coding Plan speaks three protocols. Pick the base URL your tool expects:

Protocol Base URL Typical tools
Anthropic Messages https://api.z.ai/api/anthropic Claude Code, Goose
OpenAI Chat Completions https://api.z.ai/api/coding/paas/v4 Cline, Kilo Code, Roo Code
OpenAI Responses https://api.z.ai/api/v1 Codex (wire_api = "responses")

Authentication is a standard bearer header with your Coding Plan key. The model string is glm-5.4 everywhere, plus glm-5.4[1m] in Claude Code when you want the full 1M context window. Z.ai's FAQ lists a wrong base URL as one cause of error 1113 Insufficient Balance on a paid plan: the request misses the plan and hits your pay-as-you-go balance.

How to use GLM-5.4 in Claude Code

Claude Code is the most documented path. Assuming you've subscribed and Claude Code is installed:

  1. Create a key under Personal Coding Plan > Plan Overview on z.ai (Team Plan members use Team Coding Plan > My Plan).
  2. Open ~/.claude/settings.json and add or update the env block. Don't replace the whole file if it already has other settings.
  3. Set the base URL, your key and the model mapping:
{
  "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.4[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.4[1m]",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000"
  }
}
Enter fullscreen mode Exit fullscreen mode
  1. Start a new session and run /status. The model line should show glm-5.4 or glm-5.4[1m].

If Claude Code says the [1m] model doesn't exist, update Claude Code to the latest version; Z.ai's model switching guide lists that as the fix. For a longer walkthrough of this setup with the previous model, see GLM-5.3-Flash in Claude Code and Cline.

How to use GLM-5.4 in other coding tools

Any supported tool that accepts a custom model works the same way:

  1. Choose an OpenAI Compatible provider.
  2. Set the base URL to https://api.z.ai/api/coding/paas/v4.
  3. Paste your Coding Plan key.
  4. Pick custom model and type glm-5.4.
  5. Tick image support if the tool asks: Z.ai lists GLM-5.4 as multimodal.

Tools without a custom model field have to wait for their own update.

GLM-5.4 thinking and effort settings

Thinking is on by default at max effort. Z.ai converts whatever your tool sends into three real levels:

What your tool sends Level GLM-5.4 uses
Nothing, or thinking enabled / adaptive max
Thinking disabled / off low (still thinks lightly)
reasoning_effort minimal, light, low low
reasoning_effort medium, high high
reasoning_effort xhigh, max, ultra max

In Claude Code, /effort switches the level mid-session. Z.ai recommends max for coding; drop to high or low for quick questions so the "marathon thinking" habit doesn't eat your quota.

One API change to note for later: in the Chat Completions reference, thinking.clear_thinking now defaults to false for GLM-5.4 and later. The model keeps reasoning_content from earlier turns, so your client has to send that history back complete and in order. Earlier models default to true and drop it.

GLM-5.4 pricing and quota on the Coding Plan

There's no per-token price for GLM-5.4 yet. On the Coding Plan you spend credits, calculated as:

$$\text{credits} = \frac{\text{input} \times m_{in} + \text{cached} \times m_{cache} + \text{output} \times m_{out}}{10{,}000}$$

Model Input multiplier Cached input Output multiplier
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

GLM-5.4 is cheaper per token than GLM-5.3 on the plan. A turn with 100K uncached input tokens and 10K output tokens costs (100,000 Γ— 4.6 + 10,000 Γ— 16) / 10,000 = 62 credits on GLM-5.4, against 93 on GLM-5.3. Z.ai also raised the weekly GLM-5.4 allowance to 1.5x the GLM-5.3 level for weekly-quota plans.

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

At 62 credits a turn, Lite covers about 32 such turns per 5-hour window. Cached input costs 1.1 instead of 4.6, so long sessions that reuse the same files cost far less. Compare with the standard API rates in our GLM-5.3 API guide.

Get your app ready for the GLM-5.4 Model API

You can build the integration now on GLM-5.3, which uses the same Chat Completions shape on the standard endpoint. When GLM-5.4 opens, you change the model value and check the thinking history.

curl -X POST "https://api.z.ai/api/paas/v4/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ZAI_API_KEY" \
  -d '{
    "model": "glm-5.3",
    "messages": [
      {"role": "system", "content": "You are a senior backend engineer."},
      {"role": "user", "content": "Write a Python function that validates an ISO 8601 date."}
    ],
    "thinking": {"type": "enabled"},
    "reasoning_effort": "high",
    "stream": false
  }'
Enter fullscreen mode Exit fullscreen mode

The same call works from the OpenAI SDKs by setting base_url to https://api.z.ai/api/paas/v4, or from Z.ai's own zai-sdk package (pip install zai-sdk). The API introduction has examples in Python, Java and Node.js.

Three habits make the later switch a one-line change:

  • Keep the model ID in config or an environment variable, never in code.
  • Store and resend reasoning_content per turn, since GLM-5.4 keeps it by default.
  • Set client timeouts with long thinking in mind: at 70 tokens/s during peak hours, a 10K-token answer takes over two minutes.

Sequence diagram of the GLM-5.4 switch

Let your coding agent test it with Apidog CLI

A model swap breaks integrations quietly: a new reasoning field, slower responses, a drifting schema. Let the agent you already use write and run the checks with Apidog CLI.

Install the CLI and the agent skill once:

npm install -g apidog-cli@latest
apidog login --with-token <YOUR_TOKEN>
npx -y skills add https://apidog.com   # pick your agent when prompted
Enter fullscreen mode Exit fullscreen mode

Then give your agent one prompt:

In Apidog project <projectId>, create a test case for POST https://api.z.ai/api/paas/v4/chat/completions
using my ZAI_API_KEY environment variable. Read the model from the {{model}} variable.
Assert a 200 status, a non-empty choices[0].message.content, and a response under 120 seconds.
Run it with model=glm-5.3 and summarize any failures.
Enter fullscreen mode Exit fullscreen mode

The agent finds your environment, checks the payload schema, writes the case, and runs it:

apidog environment list --project <projectId>
apidog cli-schema get test-case-create
apidog cli-schema validate test-case-create --file case.json
apidog test-case create --project <projectId> --file case.json
apidog run --test-case <caseId> --project <projectId> -e <envId> --env-var model=glm-5.3 -r cli,json
Enter fullscreen mode Exit fullscreen mode

A coding agent running Apidog CLI

The day the GLM-5.4 Model API opens, rerun the same case with --env-var model=glm-5.4 and compare the two reports. Add -r junit and the same command runs in CI; the apidog run command reference lists every flag, and Apidog CLI in Claude Code shows the agent setup end to end. Apidog is free for teams of up to 4 users.

FAQ

Is the GLM-5.4 API available to everyone? Only through the GLM Coding Plan, inside supported coding tools. The pay-as-you-go Model API opens after Z.ai's security assessment, and Z.ai hasn't given a date.

What's the GLM-5.4 model ID? glm-5.4. In Claude Code, use glm-5.4[1m] to get the 1M-token context window and set CLAUDE_CODE_AUTO_COMPACT_WINDOW to 1000000.

Can I use my Coding Plan key in my own app? Z.ai's usage policy limits the plan to officially supported tools and products, and repeat violations can end in an account ban. Build your app against the standard API with GLM-5.3 now and switch when GLM-5.4 opens there.

How much does GLM-5.4 cost? There's no per-token API price yet. On the Coding Plan, GLM-5.4 uses multipliers of 4.6 for input and 16 for output, which is about a third cheaper than GLM-5.3's 6.9 and 24. Plans start at $18 a month.

Are GLM-5.4 open weights available? Not as of November 24, 2026. Z.ai's model page lists no weights release and no date, so the Coding Plan is the only way to run it.

Top comments (0)