> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiyi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GLM-5.4 Lands on APIYI: 1M Context Flagship

> Z.ai's first Loop Transformer flagship is now available on APIYI: ~750B parameters with 2T–3T-class intelligence, 1M context, 128K output, and the first vision support on a GLM flagship. Priced the same as the official API, with recharge bonuses on top.

## Key Highlights

* **First Loop Transformer flagship**: 28 of its 78 layers share weights and run two passes, giving \~750B parameters the intelligence Z.ai claims is on par with 2T–3T models
* **1M context + 128K output**: swallow an entire codebase or hundreds of pages in one request
* **Vision on a flagship for the first time**: image, video, and file inputs (text output) — debug from screenshots, understand videos, parse documents
* **Built for generalized coding**: 51.1% win rate against GLM-5.3 in internal tests, covering code-driven video, game dev, 3D/shaders, and mechanical design
* **Same price as the official API**: \$1.40/M input, \$0.26/M cached input, \$4.40/M output — recharge bonuses bring your effective cost to roughly 83–91% of list

## Background

On November 23, 2026, Z.ai released GLM-5.4, the first **Loop Transformer** flagship in the GLM family and the first flagship with vision. Unlike GLM-5.3, which was a post-training refresh of the GLM-5.2 base, GLM-5.4 changes the architecture itself: instead of adding parameters, it runs the same block of layers twice to increase effective depth.

Z.ai positions GLM-5.4 for "generalized coding" — not just writing code, but using code to drive video generation, game development, 3D and shader modeling, and FreeCAD/Blender mechanical design.

APIYI has onboarded `glm-5.4` and it is available now through the OpenAI-compatible API.

## Deep Dive

### Benchmarks

Official internal evaluations (vendor-reported):

| Comparison | Result |
| - | - |
| vs GLM-5.3 (200 coding tasks) | 51.1% win / 25.7% tie / 23.1% loss |
| vs Kimi K3.1 Pro | 41.8% win rate |

Iso-parameter ablation at 30B (isolating the architecture effect):

| Benchmark | Same-size GLM-5.3 | Same-size GLM-5.4 |
| - | - | - |
| AIME25 | 19.17 | **30.42** |
| GPQA-Diamond | 47.58 | **56.26** |
| MMLU-Pro | 71.65 | **75.05** |
| AA-LCR | — | **+7.3** |

Training compute rose only \~10%, and outputs were 10–14% shorter — the gains come from architectural efficiency, not from thinking longer.

Third-party evaluation (KingBench 4): GLM-5.4 scored 33.2/60 (55.3%), ranking 7th of 19 models — the highest among open models, within 5% of GPT-6.2 Astra (33.6) and Opus 5.5 (34.7). Tool-call failure rate: 1.56%.

### Core Features

**Loop Transformer: depth through looping**

Classic scaling piles on layers and parameters. GLM-5.4 instead turns 28 of its 78 layers into a weight-sharing loop that runs twice per forward pass. Three engineering pieces make it work:

* **Damp Gate**: gates the write-back on the second pass to keep repeated computation from amplifying noise
* **Global KV cache sharing + separate sliding window**: keeps 1M-context memory and cost manageable
* **IndexShare**: reuses one sparse-attention indexer across every four layers, cutting per-token compute at 1M tokens

**1M context + 128K output**

Long context here is not just "it fits" — it stays usable: whole-repo retrieval, cross-chapter reasoning, and multi-turn tool use all hold up. With 128K max output, a full project scaffold in one generation is realistic.

**Multimodal input (first on a flagship)**

Text, image, video, and file inputs through a \~24-layer ViT vision encoder. Hand it an error screenshot, a product demo video, or a spec document and get code or analysis back.

**Thinking mode and full API surface**

Deep thinking (`reasoning_effort` at `low` / `high` / `max`; use `max` for hard tasks), streaming, function calling, structured JSON output, and context caching. Cached input bills at \$0.26/M tokens, a major saving for long sessions and multi-turn agents.

### Specifications

| Item | Spec |
| - | - |
| Model ID | `glm-5.4` |
| Parameters | \~750B (28/78 layers share weights in a loop) |
| Context window | 1M tokens |
| Max output | 128K tokens |
| Input modalities | Text, image, video, file |
| Output modalities | Text |
| Thinking mode | Yes, three `reasoning_effort` tiers |
| Speed | \~200 tok/s off-peak, 70–80 tok/s at peak |
| Protocol | OpenAI-compatible |

## Practical Use

### Recommended Scenarios

* **Large codebase refactoring and review**: fit an entire repo in 1M context and analyze cross-file dependencies without chunking
* **Screenshot debugging and video understanding**: UI regressions, error screenshots, and demo videos as direct inputs
* **Long-document analysis**: cross-chapter Q\&A and summarization for contracts, papers, and technical manuals
* **Generalized coding**: code-driven video, game prototypes, 3D/shaders, parametric mechanical design
* **Long-running agents**: 128K output plus cached billing suits multi-turn tool-calling automation

### Code Example

```python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="sk-your-apiyi-key",
    base_url="https://api.apiyi.com/v1",
)

resp = client.chat.completions.create(
    model="glm-5.4",
    messages=[
        {"role": "user", "content": "Implement an LRU cache with expiry in Python, plus unit tests."},
    ],
    max_tokens=8192,
    extra_body={"reasoning_effort": "max"},
)
print(resp.choices[0].message.content)
```

Multimodal input:

```python theme={null}
resp = client.chat.completions.create(
    model="glm-5.4",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What is the error in this screenshot? Give me the fix."},
            {"type": "image_url", "image_url": {"url": "https://example.com/error.png"}},
        ],
    }],
)
```

### Best Practices

* **Use `max` effort for hard tasks**: refactors and multi-step reasoning deserve `reasoning_effort: "max"`; quick lookups run faster and cheaper at `low`
* **Exploit caching**: keep fixed system prompts and long document prefixes at the front of the message; cached input bills at \$0.26/M tokens
* **Stream long-context requests**: enable `stream: true` so the first token arrives sooner on 1M-context calls
* **Pass images as HTTPS URLs or base64**: `image_url` accepts public URLs and data URIs

## Pricing and Availability

### Pricing

| Item | Price (per 1M tokens) |
| - | - |
| Input | \$1.40 |
| Cached input | \$0.26 |
| Output | \$4.40 |

Model pricing matches the official API item by item (converted at the fixed 1:7 rate — a fixed rate, not a promotional one) with **no markup**. Available groups: `Default`, `SVIP`.

### Stacking Recharge Promotions

The per-token price matches the official API; savings on APIYI come from recharge bonuses and group multipliers. After recharge bonuses, your effective price is roughly **83–91% of list**. See the recharge page for current tiers, validity, and stacking rules: [Recharge Promotions](https://docs.apiyi.com/en/faq/recharge-promotions.md).

> [!NOTE]
>
> Model pricing is aligned with the official site and may change; the table above is for reference only — the **Model Pricing** tab in the top navigation is authoritative: [Model Pricing](https://docs.apiyi.com/en/models/index.md).

## Summary

GLM-5.4 is the first time Zhipu has brought its architecture-efficiency thesis to a flagship: loops for depth, 1M context, vision on a flagship, and pricing on par with GLM-5.3. For long-context coding and multimodal engineering, it is one of the strongest value picks available today.

On APIYI, `glm-5.4` is ready through the OpenAI-compatible API, and recharge bonuses bring the effective cost to 83–91% of list. Start with a complex coding task and a long-document workflow, then scale into production.

> [!NOTE]
>
> Sources and retrieval date (2026-12-02): Z.ai official release information and pricing page; third-party KingBench 4 evaluation (AICodeKing); APIYI platform pricing API verification (model live, groups Default / SVIP). Vendor-reported numbers and third-party evaluations are labeled separately.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.