GPT Image 2.5 is live — OpenAI's newest image model, targeted edits that leave the rest of the frame alone
All resources

· reAPI Team

GLM 5.4 Pricing, Loop Transformer Specs, and API Guide

GLM 5.4 pricing ($0.98/$3.08 on reAPI vs $1.40/$4.40 list), Loop Transformer specs, live API quirks like max_tokens vs max_completion_tokens, and migration.

GLM 5.4 Pricing, Loop Transformer Specs, and API Guide

Most early write-ups on GLM 5.4 pricing are already out of date. When Z.AI unveiled GLM 5.4 on November 23, 2026, access opened first to GLM Coding Plan subscribers and ZCode while standalone per-token API access stayed marked "coming soon"[1][2]. As of December 4, 2026, direct pay-per-token billing is live on Z.AI's published rate sheet at $1.40 per million input tokens, $4.40 per million output tokens, and $0.26 per million cached input reads[3]—and live on reAPI's GLM 5.4 endpoint at $0.98 input, $3.08 output, and $0.182 cached reads (30% below official list).

Rate cards alone will not protect your monthly bill, though. When we ran live paid API probes against glm-5.4 on December 4, 2026, two runtime behaviors jumped straight out: the upstream enforces max_tokens strictly up to 131,072 tokens yet ignores max_completion_tokens, and omitting reasoning_effort defaults to max on a model Z.AI openly warns can enter long "marathon thinking" loops[1][4]. Below is the verified breakdown of GLM 5.4 pricing, Loop Transformer architecture, GLM 5.3 migration changes, live API test results, and current open-weight status.

TL;DR

  • Current token rates (checked Dec 4, 2026): Z.AI lists glm-5.4 at $1.40 input / $4.40 output / $0.26 cached input per 1M tokens—matching GLM 5.3 list pricing[3]. reAPI bills glm-5.4 (glm group, 0.7x) at $0.98 input / $3.08 output / $0.182 cache read per 1M tokens with pay-as-you-go billing and no monthly plan.
  • Architecture and limits: Built on Z.AI's 750B GLM-5 base, glm-5.4 runs 28 middle layers twice per forward pass with progressive gates, hybrid KV caching, and sparse attention index reuse, supporting a 1M context window (1,048,576 tokens) and 128K (131,072) max output[1][2].
  • Mandatory thinking: You cannot turn thinking off. In our December 4 live probes, thinking: {"type":"disabled"} and reasoning_effort set to medium, xhigh, minimal, or none all returned HTTP 400 (code: "1210"). Valid levels are strictly low, high, and max (default max).
  • Use max_tokens, not max_completion_tokens: Sending max_tokens: 30 stopped generation at exactly 30 tokens (finish_reason: "length"), while max_completion_tokens: 30 was ignored upstream (610 tokens generated). reAPI normalizes output caps onto max_tokens automatically[4].
  • Open weights are not out yet: Z.AI stated it plans to open-source GLM 5.4 weights after safety hardening finishes[2]. Teams needing local weights today still have to run earlier open-weight releases.

How GLM 5.4 pricing breaks down across official API and reAPI

Z.AI kept GLM 5.4 pricing on the exact same official list tier as GLM 5.3 and GLM 5.2 despite adding a second forward pass across 28 shared layers plus native image, video, and file understanding[3]. Rather than charging a mid-context surcharge at 128K or 200K tokens, the published API rate sheet lists one flat per-million rate for uncached input, cached input, and output across the entire 1M-token window[3].

Model & Access Route (Checked Dec 4, 2026)Input / 1MOutput / 1MCached Input / 1MContext / Max OutputBilling Model
GLM 5.4 on reAPI (glm-5.4, glm group)$0.98$3.08$0.1821M / 128KPay-as-you-go ($1 = 1,000 credits)
Z.AI Official API (glm-5.4)[3]$1.40$4.40$0.2601M / 128KPay-as-you-go (cache storage free limited-time)
Z.AI Official API (glm-5.3 / glm-5.2)[3]$1.40$4.40$0.2601M / 128KPay-as-you-go (glm-5.3 is text-only)
Z.AI Official API (glm-5.3-flashx)[3]$0.37$1.25$0.0751M / 128KLighter multimodal tier
Z.AI Official API (glm-5.3-flash)[3]$0.15$0.50$0.0301M / 128KBudget multimodal tier
MiniMax M4 on reAPI (MiniMax-M4)$0.72$2.79$0.0451M / 256KPay-as-you-go peer with adaptive thinking

Worked cost math for a 15-turn repository review

To see how GLM 5.4 pricing behaves in a realistic engineering session, take an illustrative 15-turn debugging loop (calculated from the published rates above; actual counts depend on your codebase and effort setting):

  • Static system prompt, tool schemas, and source files at turn 1: 60,000 input tokens.
  • New user/tool context added per turn across turns 2–15: 2,500 tokens per turn (35,000 fresh tokens total).
  • Average output per turn (reasoning trace plus final patch/tool call): 1,200 tokens (18,000 output tokens total across 15 turns).

Here is the bill under two scenarios:

  1. No prompt cache hits (worst-case uncached): Total prompt tokens across 15 turns = 15 × 60,000 + sum(0..14) × 2,500 = 900,000 + 262,500 = 1,162,500 input tokens, plus 18,000 output tokens.
    • At Z.AI official list ($1.40 / $4.40): $1.628 input + $0.079 output = $1.707[3].
    • On reAPI ($0.98 / $3.08): $1.139 input + $0.055 output = $1.195 (30% less).
  2. With prefix cache hits on turns 2–15 (illustrative 80% cached prefix on Z.AI's published rate sheet and reAPI): 232,500 fresh input tokens + 930,000 cached input tokens + 18,000 output tokens.
    • At Z.AI official list: $0.326 + $0.242 + $0.079 = $0.647[3].
    • On reAPI: $0.228 + $0.169 + $0.055 = $0.452.

One honest caveat from our December 4 probe: when we sent two back-to-back calls sharing a 4,530-token identical system prefix, the gateway returned cached_tokens: 0 on turn 2. Treat cache savings as something to verify in your own usage.prompt_tokens_details.cached_tokens logs before assuming high cache hit rates in your budget.

GLM 5.4 Loop Transformer architecture and GLM 5.4 vs GLM 5.3

Standard dense or MoE transformers run each layer once per token. Z.AI's launch post explains why it built the GLM 5.4 Loop Transformer differently: adding parameters helps memory-heavy recall, while long-chain coding, 3D geometry, and security reasoning are bottlenecked by effective compute depth[2]. Rather than pre-training a looped model from scratch (which Z.AI notes lags unshared networks at the same pre-training budget), it adapted its pre-trained 750B GLM-5 base through continued training so 28 middle layers run for two iterations per forward pass[2].

Three engineering choices keep that second loop from doubling memory and latency at 1M context[2]:

  • Gated Progressive Updates: Independent per-token gates regulate how strongly each loop writes back into the residual stream, stopping activation norms from exploding. Pass 1 writes conservatively to build global context; pass 2 opens the gates to refine hard tokens.
  • Hybrid KV Cache: Instead of storing two full 1M-token KV caches, the second pass reuses the sparse KV selected during pass 1 and keeps only a local sliding window of fresh pass-2 KV states.
  • Sparse Attention Index Reuse: Pass 2 reuses the sparse attention indices computed by pass 1's indexer directly, adding zero indexing overhead.

Z.AI's blog reports up to 200 tokens/s off-peak and 70–80 tokens/s at peak load via fused inference kernels[2]. Just as important for teams comparing GLM 5.4 vs GLM 5.3: Z.AI did not publish standard third-party coding leaderboard tables (like SWE-bench or LiveCodeBench) in its launch post. The only quantitative ablation in the official write-up is a controlled 30B iso-parameter experiment after 200K long-context SFT with ~10% extra training compute, where looping raised math, science, and long-context accuracy while shrinking average output length by 10–14% on benchmarks such as GPQA-Diamond and MMLU-Pro as reasoning shifted into implicit loop depth[2]. Run your own repository tasks before assuming a fixed score jump over GLM 5.3.

Migration DimensionGLM 5.4 (glm-5.4)GLM 5.3 (glm-5.3)
Core architectureLoop Transformer (28 layers × 2 on 750B base)[2]Single-pass 750B GLM-5 base
Input modalitiesText, image_url, video_url, file (file_url)[4]Text-only[4]
thinking.clear_thinking defaultfalse on all endpoints (Preserved Thinking on by default)[5]true on standard API; false only on Coding Plan[5]
Reasoning effort levelslow, high, max (default max; mandatory thinking)[4]low, high, max (default max; mandatory thinking)[4]
Context / output limits1M context / 128K (131,072) output[1]1M context / 128K (131,072) output
Direct pay-per-token API on reAPILive on reAPI (30% below list)External referral listing only

GLM 5.4 API live probe findings and two billing traps

Official OpenAPI specs tell you what a vendor intends; live probes tell you what breaks in production at 2 a.m. On December 4, 2026, we sent structured requests to the GLM 5.4 API (glm-5.4 in the glm group) covering every parameter in Z.AI's OpenAPI 3.0.1 schema[4].

Probe (Dec 4, 2026)HTTP / OutcomeExact Observed Behavior
Non-stream JSON + receipt200 PASSReturned content, reasoning_content, usage, and exact $0.000042 reAPI receipt (23 in / 6 out).
SSE streaming (stream: true)200 PASSStreamed text/event-stream chunks, emitted trailing usage + receipt, and ended with [DONE].
reasoning_effort: low / high / max200 PASSSame 17 * 23 prompt scaled cleanly: 3 reasoning tokens (low), 9 (high), 27 (max).
reasoning_effort: medium / xhigh / minimal / none400 (code: "1210")Rejected immediately (该模型始终思考,不支持关闭思考;请使用 low、high 或 max。).
thinking: enabled (clear_thinking: false / true)200 PASSBoth flags accepted cleanly.
thinking: {"type": "disabled"}400 (code: "1210")Rejected; thinking cannot be disabled on glm-5.4.
max_tokens: 30 vs 131072 vs 131073200 / 200 / 40030 capped strictly at 30 completion tokens (finish_reason: "length"); 131072 succeeded; 131073 returned 400 (1210).
max_completion_tokens: 30 (direct upstream)200 IGNOREDUpstream ignored the cap and generated 610 completion tokens (finish_reason: "stop").
do_sample: false, temperature: 0.2, top_p: 0.8200 PASSAccepted; Z.AI recommends tuning only one of temperature ([0,1]) or top_p ([0.01,1])[6].
stop: ["3"]200 PASS (enforced)Truncated cleanly at "1 2 " (finish_reason: "stop").
response_format (json_object & json_schema)200 PASSBoth returned valid JSON; keep schema validation in application code.
tools (function) + 2-turn loop + tool_stream: true200 PASSReturned tool_calls, completed turn 2 with preserved assistant turn, and streamed tool call deltas.
tools: [{"type":"web_search", ...}]400 (code: "1214")Current OpenAI-compatible channel returned tools[0].web_search empty error; use your own function tool.
n: 2200 (1 choice only)Returned a single choice; reAPI bills single-choice usage.
Public image_url (PNG)200 PASSAccurately described subject and colors (1,404 prompt tokens).
Public video_url (MP4)Mixed (200 / 400)Standard H.264 MP4 succeeded (2,275 prompt tokens, accurate scene summary); two other test MP4 files failed with 400 (1210, video format/parse error).
Anthropic Messages (/v1/messages)200 PASSNon-stream JSON (thinking + text blocks), SSE streaming, and Anthropic tools (input_schema → tool_use) all succeeded cleanly—usable directly with Anthropic SDKs and Claude Code.

Those numbers expose two real cost traps for teams migrating from OpenAI or MiniMax clients:

  1. The max_completion_tokens trap: Modern OpenAI SDK templates default to max_completion_tokens. Sent directly to a Z.AI-backed route without normalization, max_completion_tokens does not cap generation at all—an open-ended prompt can run far past your intended budget. On reAPI, the gateway normalizes your cap onto max_tokens, and the interactive playground binds directly to max_tokens.
  2. The marathon-thinking trap: Z.AI's own overview notes that glm-5.4 tends to get caught in overly long reflection loops[1]. Leaving reasoning_effort blank silently selects max. Put triage, JSON formatting, and quick diffs on reasoning_effort: "low", bump to high for normal multi-file patches, and reserve max for architecture or gnarly bug hunts.

Streaming tool calls, Preserved Thinking, and multimodal inputs in practice

Starting with glm-5.4, Z.AI turned Preserved Thinking (thinking.clear_thinking: false) on by default across all API endpoints[5]. In multi-turn coding agents, that means you should echo the exact, unmodified assistant message—including reasoning_content and tool_calls—alongside your role: "tool" results. Stripping or rewriting historical reasoning degrades multi-step coherence[5].

Z.AI also recommends enabling both stream: true and tool_stream: true on agent loops so your client receives tool arguments incrementally instead of stalling until a large JSON payload finishes[1][6]:

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.reapi.ai/v1",
    max_retries=0,
)

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_deploy_status",
            "description": "Return the latest deployment status for a service.",
            "parameters": {
                "type": "object",
                "properties": {"service": {"type": "string"}},
                "required": ["service"],
            },
        },
    }
]

stream = client.chat.completions.create(
    model="glm-5.4",
    messages=[{"role": "user", "content": "Check billing-api deploy health."}],
    tools=tools,
    tool_choice="auto",
    max_tokens=4096,
    stream=True,
    extra_body={
        "thinking": {"type": "enabled", "clear_thinking": False},
        "reasoning_effort": "low",
        "tool_stream": True,
    },
)

for chunk in stream:
    if not chunk.choices:
        continue
    delta = chunk.choices[0].delta
    if getattr(delta, "reasoning_content", None):
        print(delta.reasoning_content, end="", flush=True)
    if delta.content:
        print(delta.content, end="", flush=True)

For multimodal requests inside messages[].content[], follow three strict rules documented in the GLM 5.4 API reference:

  • Public HTTP(S) URLs only on reAPI: Send reachable https:// or http:// links for image_url (JPEG/PNG up to 5 MB, max 6000 × 6000 px), video_url (MP4/MKV/MOV up to 200 MB—re-encode unusual clips to standard H.264 MP4 if you hit error 1210), and file ({"type":"file","file":{"file_url":"https://..."}}, up to 50 MB each across PDF, TXT, Word, JSONL, XLSX, and PPTX). Base64 data: URIs and vendor file_id handles are not accepted.
  • No mixing file with images or video: Z.AI's OpenAPI spec explicitly forbids sending file blocks in the same request as image_url or video_url[4].
  • No audio input: Audio-only files are not part of the glm-5.4 multimodal contract[4].

GLM 5.4 open weights status and when to stay on GLM 5.3

Search demand around glm 5.4 huggingface, GLM 5.4 open weights, and glm 5.4 ollama is huge right now, and the short answer as of December 4, 2026 is that the weights are not public yet. Z.AI's launch blog states it intends to open-source the weights after completing safety hardening, with no fixed release date announced[2].

If your compliance boundary requires self-hosting weights inside your own VPC today, staying on an already-released open-weight checkpoint (such as GLM 5.3 or earlier GLM-5 weights) is the only practical option until Z.AI publishes the Hugging Face repo. If you can call a hosted endpoint and want visual debugging, document parsing, or deeper looped reasoning without paying more per million tokens, moving straight to glm-5.4 makes sense: same list price, wider modality support, and Preserved Thinking enabled by default.

Frequently asked questions

Is GLM 5.4 free to use?

No. Direct API traffic is billed per token across input, output (thinking plus visible tokens), and cached input reads. On reAPI, new accounts receive 100 starter credits ($0.10) for quick smoke tests, followed by pay-as-you-go billing with no monthly subscription.

How much cheaper is GLM 5.4 on reAPI than official Z.AI list rates?

As of December 4, 2026, Z.AI's official rate sheet lists $1.40 input, $4.40 output, and $0.26 cached input per 1M tokens[3]. reAPI's glm group (0.7x) prices glm-5.4 at $0.98 input, $3.08 output, and $0.182 cache read per 1M tokens, a flat 30% reduction across all three dimensions.

Can I turn off thinking mode on GLM 5.4 to cut costs?

No. Deep thinking is always on. Passing thinking: {"type": "disabled"} or reasoning_effort: "none" returns HTTP 400 (code: "1210"). To lower latency and token spend on simple prompts, set reasoning_effort: "low" and enforce an explicit max_tokens ceiling.

Why did max_completion_tokens not stop my GLM 5.4 output?

Z.AI's OpenAPI 3.0.1 schema defines max_tokens (1–131,072), not max_completion_tokens[4]. Our December 4 live probes verified that max_completion_tokens is ignored upstream when sent raw. Pass max_tokens directly (reAPI also normalizes admitted caps onto max_tokens).

Does GLM 5.4 work with images, video, files, and audio?

Images (image_url), video (video_url), and documents (file.file_url) are supported; audio is not[4]. Keep in mind that file blocks cannot be combined with image_url or video_url in the same request, and reAPI accepts public HTTP(S) URLs only.

Does Z.AI's built-in web_search tool work over the OpenAI-compatible API?

Not on the current OpenAI-compatible channel. Our December 4 probe with type: "web_search" returned HTTP 400 (code: "1214"). Standard type: "function" tools and tool_stream: true work reliably, so implement web search as a regular function tool in your app.

When should I pick GLM 5.4 over GLM 5.3 or MiniMax M4?

Pick glm-5.4 over GLM 5.3 whenever you need image/video/file inputs, deeper multi-step reasoning, or direct pay-per-token reAPI billing. Compare GLM 5.4 against MiniMax M4 ($0.72 / $2.79 per 1M, 256K max output, five effort tiers) on your own benchmark set if raw token budget or outputs beyond 128K tokens matter more than tunable sampling (temperature, top_p, stop).

Picking the right GLM 5.4 setup for your workload

For most engineering teams, getting predictable GLM 5.4 pricing comes down to three concrete defaults: route glm-5.4 through a single OpenAI-compatible key with max_tokens explicitly capped, default routine routes to reasoning_effort: "low" instead of letting implicit max trigger marathon thinking, and turn on stream: true with tool_stream: true plus unmodified reasoning_content echo on multi-turn agents.

You can test all 16 official Z.AI parameters interactively and check current live rates on the GLM 5.4 model page, or grab ready-to-run cURL, Python, Node.js, and Go snippets in the GLM 5.4 API documentation.

References

More Posts

All resources