Zhipu Z.ai · glm-5.4
GLM-5.4 API
Zhipu's latest flagship and its first on a Loop Transformer. It adds vision and extends coding to video, games and 3D, and it costs the same as GLM-5.3. On AnyAIGC it costs about 60% less than the official price.
glm-5.4 input $0.5628 per 1M tokens, output $1.7690 per 1M tokens, cache hit $0.1045. Works with the OpenAI-compatible API and in Claude Code.
- Model ID glm-5.4
- Context 1M tokens
- Input $0.5628 / 1M
- Concurrency Unlimited
- Business Self-service invoices
A Loop Transformer with vision
Zhipu calls GLM-5.4 its latest flagship and the first built on a Loop Transformer. A set of layers with shared weights runs in a loop, so the model reasons deeper with the same parameter count; Zhipu says its intelligence is comparable to 2T–3T parameter models. The official blog is dated November 23, 2026.
GLM-5.4 adds vision understanding and extends coding beyond software to video production, game development, 3D modeling and mechanical design, which Zhipu calls "generalized coding". With tool support, you can hand it a storyboard, reference images or design requirements, and it writes code, calls professional software and revises the work from the results.
On AnyAIGC, glm-5.4 runs on the OpenAI-compatible /v1/chat/completions endpoint, accepts image input, and works directly in Claude Code. No Zhipu platform account or Coding Plan needed: you pay per token, with unlimited concurrency.
- Context window
- 1Mtokens
- Max output
- 128Ktokens
- Architecture
- Loop TransformerShared-weight layers run in a loop
- Input
- Text, image, video, filePer Zhipu; examples here use images
- Thinking
- Always onreasoning_effort: low / high / max
- Weights
- Not yet releasedPlanned after safety hardening
What GLM-5.4 can do
- 01
Generalized coding
Zhipu extends coding to video production, game development, 3D modeling and mechanical design. With tools, the model writes code, drives professional software and keeps revising from the results.
- 02
Visual coding and replication
Send a screenshot, design file or reference image, and get code back. Zhipu says GLM-5.4 stands out on visual coding and visual replication.
- 03
Long-horizon tasks
Zhipu says GLM-5.4 stands out on long-horizon tasks in its internal evaluation of 200 real coding scenarios, where it ranks near the top among the Chinese models tested.
- 04
Deeper reasoning per parameter
The Loop Transformer reuses shared-weight layers in a loop, and Zhipu says this puts its intelligence level comparable to 2T–3T parameter models.
- 05
Adjustable thinking depth
Thinking is always on. Set reasoning_effort to low, high or max: save tokens on simple tasks and use max for hard problems. Zhipu notes the model can think very long on hard inputs.
- 06
Tools and structured output
Function calling, structured output, streaming and context caching are supported. Repeated prompt prefixes are billed at the cache-hit rate.
GLM-5.4 API pricing
Pay per token at fixed rates, with no subscription or monthly fee. Input, output and cache hits cost about 40.2% of Zhipu's official USD prices (about 60% off), the same as GLM-5.3.
- Per tokenInput, output and cache priced separately
- About 60% offvs Zhipu official USD prices
- Unlimited concurrencyOn by default for every user
- USDOne balance for 300+ models
| Item | Model | AnyAIGC | Zhipu official | Savings |
|---|---|---|---|---|
| Inputper 1M tokens | glm-5.4 | $0.5628 | $1.40 | 60% |
| Outputper 1M tokens, incl. thinking | glm-5.4 | $1.7690 | $4.40 | 60% |
| Cache hitper 1M tokens | glm-5.4 | $0.1045 | $0.26 | 60% |
Prices are in USD and billed on the tokens you actually use. Output includes thinking tokens, and repeated prompt prefixes are billed at the cache-hit rate automatically. Official prices come from the Zhipu Z.ai pricing page (USD). The table shows the lowest price in the model catalog; see the AnyAIGC model catalog for live pricing.
Cost examples
Estimates for common workloads. The struck-through figure is the same usage at Zhipu official prices.
-
20 agent coding turns
Each turn: 50K cache-hit tokens + 5,000 input + 3,000 output
$0.267
Official
$0.664 -
Analyze a 500K-token codebase
500K input tokens + 5,000 output
$0.290
Official
$0.722 -
1M input + 1M output
1M input tokens + 1M output tokens
$2.33
Official
$5.80
Zhipu's published comparison
Zhipu's GLM-5.4 blog publishes head-to-head win rates from its internal evaluation, not per-benchmark scores.
GLM-5.4 win rate · Zhipu internal evaluation
| GLM-5.4 vs | Win % | Tie % | Lose % |
|---|---|---|---|
| GLM-5.3Zhipu previous flagship | 51.1 | 25.7 | 23.1 |
| Kimi K3.1 ProMoonshot AI | 41.8 | 26.9 | 31.3 |
| DeepSeek-V4.1-Flash-1017DeepSeek | 36.6 | 30.2 | 33.2 |
Source: the GLM-5.4 blog. These are Zhipu's own results; the evaluation set and judging method are not published, so treat them as a rough guide and test on your own tasks.
GLM-5.4 vs GLM-5.3 vs GLM-5.3-Flash vs GLM-5.2
Start new projects on GLM-5.4: it costs the same as GLM-5.3 and adds vision. Use GLM-5.3-Flash for high-volume, budget-sensitive work and GLM-5.2 when thinking should be off.
| Spec | GLM-5.4 | GLM-5.3 | GLM-5.3-Flash | GLM-5.2 |
|---|---|---|---|---|
| Role | Latest flagship | Previous flagship | Native multimodal, low cost | Long-horizon flagship |
| Context / max output | 1M / 128K | 1M / 128K | 1M / 128K | 1M / 128K |
| Input | Text, images, video, files (official) | Text | Text, images | Text |
| Thinking | Always on | Always on | Always on | On or off |
| AnyAIGC inputper 1M tokens | $0.5628 | $0.5628 | $0.0603 | $0.5628 |
| AnyAIGC outputper 1M tokens | $1.7690 | $1.7690 | $0.2010 | $1.7690 |
| Cache hitper 1M tokens | $0.1045 | $0.1045 | $0.0121 | $0.1045 |
Specs come from Zhipu Z.ai's official docs. Prices are current AnyAIGC prices; see the model catalog for live pricing. More on the GLM-5.3 API, GLM-5.3-Flash API and GLM-5.2 API.
Where GLM-5.4 fits
- 01 · Design to code
Screenshots and mockups to working UI
Send a design file or page screenshot and get HTML, CSS or component code back, then iterate on the rendered result.
- 02 · Games and 3D
Prototypes and tool-driven creation
Zhipu positions GLM-5.4 for game development and 3D modeling: describe the scene or paste references, and let the agent write code and call your tools.
- 03 · Coding agents
Claude Code and custom agents
Run tasks of dozens or hundreds of steps in Claude Code or your own agent framework: read code, run tests, fix errors. AnyAIGC does not cap concurrency.
- 04 · Automation
Tool calls and workflow orchestration
Combine function calling and structured output to chain internal systems, scripts and APIs into automated workflows. Repeated system prompts are billed at the cache-hit rate.
Connect to the GLM-5.4 API in three steps
- Sign up and add credit: create an account at anyaigc.ai. Top up from $1; your balance works across every model on the platform.
- Create an API key: create a key in the console, copy the value that starts with
sk-, and store it in theANYAIGC_API_KEYenvironment variable. - Send a request: call
POST https://anyaigc.ai/v1/chat/completionswithmodelset toglm-5.4and anAuthorization: Bearerheader. With the OpenAI SDK, just setbase_urltohttps://anyaigc.ai/v1.
curl https://anyaigc.ai/v1/chat/completions \
-H "Authorization: Bearer $ANYAIGC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.4",
"messages": [
{"role": "user", "content": "Explain what a Loop Transformer is in three sentences."}
]
}'
import os
from openai import OpenAI
client = OpenAI(
base_url="https://anyaigc.ai/v1",
api_key=os.environ["ANYAIGC_API_KEY"],
)
resp = client.chat.completions.create(
model="glm-5.4",
messages=[
{"role": "system", "content": "You are a senior backend engineer. Answer with runnable code."},
{"role": "user", "content": "Write an HTTP client in Go with timeouts and retries."},
],
)
msg = resp.choices[0].message
print(getattr(msg, "reasoning_content", None)) # reasoning trace, if any
print(msg.content)
print(resp.usage)
import base64
import os
from pathlib import Path
from openai import OpenAI
client = OpenAI(base_url="https://anyaigc.ai/v1", api_key=os.environ["ANYAIGC_API_KEY"])
# Encode a local image as a Base64 data URL; a public image URL works too
b64 = base64.b64encode(Path("design.png").read_bytes()).decode()
resp = client.chat.completions.create(
model="glm-5.4",
messages=[{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
{"type": "text", "text": "Build a responsive HTML + CSS page from this design."},
],
}],
)
print(resp.choices[0].message.content)
import json
import os
from openai import OpenAI
client = OpenAI(base_url="https://anyaigc.ai/v1", api_key=os.environ["ANYAIGC_API_KEY"])
tools = [{
"type": "function",
"function": {
"name": "run_tests",
"description": "Run the unit tests at a path in the repo and return the failing cases",
"parameters": {
"type": "object",
"properties": {"path": {"type": "string", "description": "Test file or directory"}},
"required": ["path"],
},
},
}]
messages = [{"role": "user", "content": "Run tests/test_api.py and tell me which cases fail."}]
resp = client.chat.completions.create(model="glm-5.4", messages=messages, tools=tools)
msg = resp.choices[0].message
# In multi-turn and tool calls, send the full assistant message (incl. reasoning_content and tool_calls) back unchanged
messages.append(msg.model_dump(exclude_none=True))
for call in msg.tool_calls or []:
args = json.loads(call.function.arguments)
result = {"path": args["path"], "failed": ["test_login_timeout"]} # replace with the real result
messages.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps(result)})
final = client.chat.completions.create(model="glm-5.4", messages=messages, tools=tools)
print(final.choices[0].message.content)
Tip: GLM-5.4 always thinks. Its reasoning comes back in the reasoning_content field, and reasoning_effort sets the depth. Zhipu recommends temperature=1, top_p=0.95 and thinking.clear_thinking=false. For streaming tool calls, turn on both stream and tool_stream. In multi-turn chats and tool calls, send the full assistant message from the API (including reasoning_content and tool_calls) back in the next request unchanged.
See the Chat Completions reference for every parameter. Replace the model name in the docs examples with the GLM model ID you want.
Use GLM-5.4 in Claude Code
Switch Claude Code to GLM-5.4 by editing one config file, and code in your terminal with Zhipu's latest flagship, billed per token.
- Install Claude Code: use the official installer, for example
curl -fsSL https://claude.ai/install.sh | bashon macOS or Linux. - Add the config: edit
~/.claude/settings.json, add the env block below, and replaceANTHROPIC_AUTH_TOKENwith the key you created on AnyAIGC. - Start coding: run
claudein your project folder. Type/modelto confirm the current model isglm-5.4.
{
"env": {
"ANTHROPIC_BASE_URL": "https://anyaigc.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-your-API-key",
"ANTHROPIC_MODEL": "glm-5.4",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.4",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.4",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.3-flash",
"API_TIMEOUT_MS": "300000",
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
}
}
Save on light tasks: the config sets ANTHROPIC_DEFAULT_HAIKU_MODEL to glm-5.3-flash, so Claude Code's lightweight subtasks use the cheaper model while the main work stays on GLM-5.4.
For the full walkthrough and common errors, see the Claude Code setup guide. Swap the model name in the guide for glm-5.4.
GLM-5.4 API for teams and enterprises
Teams can top up, issue invoices themselves, and work with a dedicated support and technical contact.
- Invoices
Issue them yourself
Issue an invoice in the console for the amount you actually topped up, whenever you need one.
- Dedicated support
Account and technical contacts
Work with a dedicated support contact and technical engineer for onboarding, migration and troubleshooting.
- WeChat Pay
- Alipay
- USDT
- Credit card
Why teams trust AnyAIGC
Trial credit, top-ups, refunds, data handling and billing, spelled out up front.
5M free tokens to start
New accounts get trial credit, so you can test before you top up.
Top up from $1, refundable
Top up from $1. Unused balance can be refunded with no fee.
Official channels, real models
Requests go to official model channels, never cheaper or reverse-engineered substitutes.
No retention, no training
Unless the law requires it, your prompts and outputs are not persistently stored or used for training. See the privacy policy.
Transparent billing, spend caps
See tokens and cost for every request in the console, and set a quota on each API key.
24/7 support
Contact support any time about integration, billing or incidents.
Other GLM models
One API key calls every GLM model below. Pick by task difficulty and budget.
- GLM overviewGLM-5.4, GLM-5.3, GLM-5.3-Flash and GLM-5.2 pricing compared
- LatestGLM-5.4Loop Transformer flagship with vision, 1M context · input $0.5628 / 1M
- GLM-5.3Previous flagship for coding and agents, text only · input $0.5628 / 1M
- Low costGLM-5.3-FlashNative multimodal, 320B total / 18B active · input $0.0603 / 1M
- GLM-5.2Long-horizon flagship, thinking optional · input $0.5628 / 1M
Specs and how to choose it
Z.ai's docs call GLM-5.4 its latest flagship model and the first built on the Loop Transformer architecture, with intelligence the vendor compares to 2T–3T parameter models, plus new vision understanding.
Official input modalities are video, image, text and file, with text output; the context window is 1M tokens and maximum output is 128K tokens; function calling, structured output and context caching are supported.
Reasoning is always on: thinking.type only accepts enabled and disabling it returns an error; reasoning_effort takes low, high or max (default max); the docs recommend temperature 1, top_p 0.95 and thinking.clear_thinking set to false.
This page lists Input at $0.5628, Output at $1.7690, Cache hit at $0.1045, matching the pricing table above.
Compared with glm-5.3: Z.ai's internal evaluation on 200 real coding scenarios reports GLM-5.4 against GLM-5.3 at 51.1 / 25.7 / 23.1 win / tie / lose, with the evaluation set and judging method unpublished; the official price matches GLM-5.3, and the thinking.clear_thinking default changes from true to false when you switch models.
Specs come from the vendor's official documentation (docs.z.ai). The table on this page is the price, and the model catalog is authoritative for live rates.
GLM-5.4 API FAQ
How much does the GLM-5.4 API cost?
On AnyAIGC, glm-5.4 is billed per token: input $0.5628 per 1M tokens, output $1.7690 per 1M tokens, cache hit $0.1045 per 1M tokens. Zhipu's official USD prices are input $1.40, output $4.40 and cache hit $0.26, the same as GLM-5.3, so AnyAIGC costs about 40.2% of official (about 60% off). Output includes thinking tokens. See the model catalog for live pricing.
What is the GLM-5.4 model ID, and how large is the context?
The model ID is glm-5.4. Zhipu lists a 1M-token context window and up to 128K output tokens. Zhipu's docs list video, image, text and file input and text output.
How is GLM-5.4 different from GLM-5.3?
GLM-5.4 is Zhipu's first flagship on a Loop Transformer, where a set of layers with shared weights runs in a loop so the model can reason deeper without more parameters. Zhipu says its intelligence is comparable to 2T–3T parameter models. It also adds vision understanding, which GLM-5.3 does not have (text only). In Zhipu's internal evaluation, GLM-5.4 beat GLM-5.3 in 51.1% of comparisons, tied in 25.7% and lost in 23.1%; Zhipu does not publish the evaluation set or the judging method. On AnyAIGC the two cost the same ($0.5628 input, $1.7690 output).
Can I turn off thinking on GLM-5.4? How do I set the depth?
No. GLM-5.4 always thinks: thinking.type only accepts enabled, and Zhipu says turning it off returns an error. Set depth with reasoning_effort: low, high or max (default max). Zhipu also recommends temperature=1, top_p=0.95 and thinking.clear_thinking=false. Zhipu names one limitation: the model can fall into very long thinking, which it says keeps improving accuracy. Use low on simple tasks to cut output tokens.
Does GLM-5.4 accept images? How do I send them?
Yes. Add a {"type": "image_url", "image_url": {"url": ...}} content block to the messages[].content array. The url can be a public image URL or a Base64 data URL; for several images, add several blocks. Zhipu's docs also list video and file input for GLM-5.4. The examples on this page cover images only, so test video and file input on your own requests before relying on them.
Does GLM-5.4 support tool calls and structured output?
Yes. Zhipu's docs list function calling, structured output (JSON), streaming and context caching. For streaming tool calls Zhipu suggests turning on both stream and tool_stream. In multi-turn chats and tool calls, send the full assistant message (including reasoning_content and tool_calls) back in the next request unchanged.
Can I use GLM-5.4 in Claude Code?
Yes. In the env block of ~/.claude/settings.json, set ANTHROPIC_BASE_URL to https://anyaigc.ai, ANTHROPIC_AUTH_TOKEN to your API key, and ANTHROPIC_MODEL to glm-5.4. Then run claude. You pay per token, with no 5-hour quota window like a subscription plan.
Is GLM-5.4 open source?
Not yet. Zhipu says it plans to open-source the GLM-5.4 weights after completing necessary safety hardening, and has not published them. Zhipu has not published GLM-5.4's total or active parameter counts either. Calling the API through AnyAIGC needs no self-hosting. Commercial use is governed by Zhipu AI's official terms.
Are there concurrency or rate limits?
AnyAIGC does not cap concurrency for glm-5.4, and every user gets this by default. That suits batch jobs, CI pipelines and parallel agents. Billing is per token, so there is no quota that resets on a time window like a subscription plan.
How do I get a GLM-5.4 API key?
Sign up at anyaigc.ai, add credit, and create a key in the console. The same key works for every GLM model and 300+ other models on the platform, so you do not need a separate Zhipu platform account or a GLM Coding Plan.
Can I get an invoice from AnyAIGC?
Yes. You can issue invoices yourself in the console, for the amount you actually topped up.
Which payment methods are supported?
You can top up with WeChat Pay, Alipay, USDT or a credit card. Your balance is in USD and works across every model on the platform. Invoices can be issued in the console for the amount you topped up.
Is there free trial credit for new users?
Yes. New accounts get 5 million tokens of trial credit, so you can test before deciding to top up. Top-ups start at $1.
Can I get a refund on my balance?
Yes. Unused balance can be refunded with no fee. Contact support to start a refund.
Are these the real models? Is my data safe?
Requests go to official model channels, never cheaper or reverse-engineered substitutes. Unless the law requires it, we do not persistently store your prompts or outputs or use them for training, and the console shows tokens and cost for every request.
Will my data be used for training?
No. Except where required by law, AnyAIGC does not persistently store your prompts or outputs and does not use them to train models. Requests are encrypted over HTTPS. See the AnyAIGC Privacy Policy. The model's own data policy is governed by Zhipu AI's official terms.
Run GLM-5.4 at about 60% off the official price
Sign up, create an API key, and you can use glm-5.4 in your code or Claude Code within minutes.