Z.ai
GLM 5.4
Z.ai's new flagship for coding and agent work runs part of its network twice per token, buying deeper reasoning without adding parameters.
Replaces GLM 5.3: same input and output price, context 1M → 1M, max output 1M → 262K.
Launch coverage: GLM-5.4 release notes
Run this model
zai/glm-5.4
Use an endpoint supported by this model.
Get a key for this setup →const response = await fetch('https://api.minirouter.sh/v1/chat/completions', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MINIROUTER_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ model: 'zai/glm-5.4', messages: [{ role: 'user', content: 'Why is the sky blue?' }], max_tokens: 1024, }),}) const data = await response.json()console.log(data.choices[0].message.content)Set max_tokens on every request and cap agent turns.
Model overview
- Input / 1M
- $1.47
- All-in MiniRouter rate
- Output / 1M
- $4.62
- All-in MiniRouter rate
- Context
- 1M
- 1,048,576 tokens
- Max output
- 262K
- tokens
- Architecture
- Loop Transformer
- Layers 27–54 run twice per token
- Reasoning
- low · high · max
- Always on
- Announced
- 23 Nov 2026
- publisher release
Compare text-model alternatives or estimate token costs for your workload.
Same weights, a second pass
Z.ai aims GLM-5.4 at long-chain reasoning work such as large-scale software engineering, and at code that produces video, games, 3D scenes and CAD models.
Z.ai turned its 750B-scale GLM-5 base into a Loop Transformer through continued training rather than pre-training from scratch. A 28-layer middle block runs twice per token with shared weights, so the model gets deeper without getting bigger. Z.ai says the result reaches intelligence comparable to 2T–3T-parameter models.
In a controlled test on a 30B model with the same architecture, Z.ai reports that looping cut average output length by 10–14% on most benchmarks: part of the reasoning moves from visible tokens into the loop.
Layer layout
- Looped block
- 28 layers × 2Layers 27–54, shared weights
- Layer passes per token
- 106From 78 stored layers, counted from Z.ai's diagram
- Second-pass KV cache
- 128-token windowReuses the first pass's sparse KV for the rest
View chart data
| Block | Layers | Count | Passes per token |
|---|---|---|---|
| Prelude | 1–26 | 26 | 1 |
| Loop | 27–54 | 28 | 2 |
| Coda | 55–78 | 24 | 1 |
| Total | 1–78 | 78 stored | 106 layer passes |
Three changes keep a second pass affordable.
- [ 01 ]
Gated updates
Per-token gates control how much each pass writes back. The first pass writes conservatively to build context; the second opens the gates to refine. Harder tokens get larger first-pass updates.
- [ 02 ]
Hybrid KV cache
The second pass reuses the sparse KV selected in the first and keeps only a local sliding window of its own. An extra loop costs one window of cache, not a full-context copy, which Z.ai says keeps the added 1M-context serving cost over GLM-5.3 well under control.
- [ 03 ]
Sparse index reuse
The second pass reuses the first pass's sparse-attention indices instead of recomputing them. Z.ai reports nearly identical results with no extra indexing cost.
A clear edge over GLM-5.3, close against the field
Z.ai published no standard benchmark scores for GLM-5.4. Its pairwise comparisons put GLM-5.4 ahead of GLM-5.3 in 51.1% of cases and behind in 23.1%. The margin narrows against Kimi K3.1 Pro and is roughly even against DeepSeek V4.1 Flash 1017.
Three comparisons
Win, tie and loss rates
- GLM-5.4 wins
- Ties and opponent wins
GLM-5.4 vs
GLM-5.3
- GLM-5.4 wins51.1%
- Tie25.7%
- GLM-5.3 wins23.1%
0 to 100% of comparisons
GLM-5.4 vs
Kimi K3.1 Pro
- GLM-5.4 wins41.8%
- Tie26.9%
- Kimi K3.1 Pro wins31.3%
0 to 100% of comparisons
GLM-5.4 vs
DeepSeek V4.1 Flash 1017
- GLM-5.4 wins36.6%
- Tie30.2%
- DeepSeek V4.1 Flash 1017 wins33.2%
0 to 100% of comparisons
View chart data
| Opponent | GLM-5.4 wins | Tie | Opponent wins |
|---|---|---|---|
| GLM-5.3 | 51.1% | 25.7% | 23.1% |
| Kimi K3.1 Pro | 41.8% | 26.9% | 31.3% |
| DeepSeek V4.1 Flash 1017 | 36.6% | 30.2% | 33.2% |
Budget for long thinking.
- [ 01 ]
Set hard limits
Reasoning cannot be turned off. Give every request a max_tokens value and every agent loop a turn limit.
- [ 02 ]
Choose the effort
Effort can be low, high or max. Z.ai recommends max with temperature 1; compare lower efforts on routine steps by accepted results and billed usage.
- [ 03 ]
Text in, text out
MiniRouter accepts text input only for this model and does not enforce response schemas. Extract document text first, and validate any JSON in your application.
- [ 04 ]
Retest against GLM-5.3
On MiniRouter, GLM-5.3 supports response schemas and up to 1M output tokens; GLM-5.4 caps a response at 262,144 tokens and has no schemas. GLM-5.3 still wins 23.1% of Z.ai's comparisons; check both on your own tasks.
One route, standard clients.
https://api.minirouter.sh/v1zai/glm-5.4/v1/chat/completions/v1/messages/v1/responsesConfigured providers. Priority follows the live catalog order.
| Provider | Priority | Input / 1M | Output / 1M | Parameters | Access |
|---|---|---|---|---|---|
vercel | 1 | $1.47 | $4.62 | max_tokens, temperature, stop, tools, tool_choice, reasoning, include_reasoning | MiniRouter balance |