New Sign up free, 10 calls on us. Up to $1, no card needed.

GLM-5.1

Released 2026-04-07

chatCodeReasoningTool callingPrompt caching

GLM-5.1 is Z.AI's flagship foundation model designed for long-horizon tasks, officially described as able to work continuously and autonomously on a single task for up to 8 hours, covering planning, execution, testing, fixing, and delivery.

Input
text $1.4/M
Output
text $4.4/M
Cache read
$0.26/M
Context
203K
vs GPT-4o
~72% cheaper

Price in context

Where the price sits among 68 comparable models

Input$1.4/M
$0.1 · Dola Seed 2.0 Mini GPT-5.4 Pro · $30
Output$4.4/M
$0.275 · DeepSeek V4 Flash GPT-5.4 Pro · $180
Cache read$0.26/M
$0.01 · Claude Haiku 5.5 GPT-5.4 Pro · $15

The bar shows how this model’s price compares with every other model of the same kind on Synthorai. The cheapest and the most expensive are named at each end. These are base rates; batch, region and cache-write discounts are on the pricing page.

Specs & limits

Tokens

Context window (vendor spec) 200,000
Max output (vendor spec) 131,072

Prompt caching

How it caches automatic

Thinking

Vendor control thinking.type
Accepted values enabled · disabled
Default enabled, and the model automatically determines whether to think applied when the request sets nothing
Can be turned off Yes
Thinking behaviour Trace returns in reasoning_content; prior turns' traces are cleared by default (clear_thinking true), and interleaved thinking blocks should be preserved and returned together with tool results. No reasoning_effort control: that is documented as GLM-5.2 only.
Parameter reasoning_effort
Values minimal · low · medium · high the gateway's parameter surface; the vendor mapping above applies

Model

Modalities text → text
Parameters 744B total · 40B active MoE
License MIT
  • Next-gen agentic-engineering flagship (744B-A40B): works autonomously up to 8 hours in a single run across thousands of tool calls
  • 200K context / 128K max output

per Z.ai official docs ↗

One prompt, measured through the gateway

PROMPT Explain to a CFO, in exactly three sentences, why our LLM bill doubled after we enabled reasoning. CHECK exactly 3 sentences

GLM-5.1 passed · 3 sentences

Enabling reasoning shifts the LLM from generating quick answers to producing hidden "chain-of-thought" tokens that systematically explore multiple solution paths before responding. Because billing is based on total tokens processed, these invisible reasoning tokens drastically increase input and output volume per query, often adding thousands of compute-intensive tokens to a single prompt. Consequently, our bill doubled not from higher per-token rates or increased user volume, but from the exponentially deeper computational work required to deliver higher-quality, more reliable outputs.

out 98 tok latency 7.8 s

Instruction following (exactly three sentences, so countable), audience shaping (CFO register), and the hidden-thinking billing gap the token meters below expose.

PROMPT This function is supposed to return the longest run of consecutive equal items, but callers report it is off by one on single-element inputs and misses runs that end at the last index. Fix it and explain the bug in one paragraph. CHECK fix passes tests

GLM-5.1 passed · 8/8 cases

```python def longest_run(xs): if not xs: return 0 best = 1 cur = 1 for i in range(1, len(xs)): if xs[i] == xs[i - 1]: cur += 1 best = max(best, cur) else: cur = 1 return best ``` **Explanation:** The original function initialized `cur` and `best` to `0` and only incremented `cur` when a duplicate was found. This counts the number of *extra* equal items in a run rather than the total run length, so every run is reported as one shorter than it actually is—returning `0` for single-element lists and `L-1` for a run of length `L` (including those ending at the last index). The fix initializes `cur` and `best` to `1` (when the list is non‑empty) and resets `cur` to `1` on a mismatch, so `cur` tracks the full length of the current run and `best` records the true maximum.

out 3823 tok (+3585 thinking) latency 49.7 s

Whether the fix is actually correct (runnable), explanation density, and token efficiency on a bounded task.

PROMPT Extract a JSON object with fields {company, quarter, revenue_usd_m, growth_pct, guidance} from this text. Use null for anything not stated; add no other fields. CHECK valid JSON, schema exact

GLM-5.1 passed · 5/5 fields, guidance "withheld pending the Q4 close"

```json { "company": "Meridian Robotics", "quarter": "September quarter", "revenue_usd_m": 412, "growth_pct": "eleven and change", "guidance": "withheld pending the Q4 close" } ```

out 1091 tok (+1028 thinking) latency 15.2 s

Schema obedience (no invented fields), hallucination pressure (guidance is explicitly withheld), and structured-output path differences.

PROMPT Write a 120-word product announcement for an API gateway feature that caches prompts across providers. Forbidden words: "seamless", "unlock", "game-changer", "revolutionize", "empower". Exactly one sentence must be a question. CHECK 120 words, 0 banned words

GLM-5.1 passed · 120 words, 0 banned, 1 question

We are excited to introduce Prompt Cache for our API Gateway. This new feature stores responses for identical prompts, routing subsequent requests directly to the cache instead of calling the underlying AI provider. Are you tired of paying multiple times for the exact same query? Prompt Cache solves this by recognizing duplicate inputs across all supported providers, drastically reducing latency and operational costs. When a user submits a request that matches a previously cached prompt, the gateway returns the stored answer instantly. You can configure cache expiration and scope rules via your dashboard to maintain data freshness. Stop wasting budget on redundant computational work. Upgrade to the latest gateway tier today to start saving time and money on every call.

out 3935 tok (+3802 thinking) latency 41.1 s

Constraint obedience (word budget, banned-word list, the single question), style fingerprint, and length control.

Use GLM-5.1 in 30 seconds

OpenAI-compatible: swap the base_url, keep your SDK. POST /v1/chat/completions

from openai import OpenAI

client = OpenAI(
    base_url="https://synthorai.io/v1",
    api_key="sk-syn-...",
)

resp = client.chat.completions.create(
    model="glm-5.1",
    messages=[{"role": "user", "content": "Summarize this diff"}],
    reasoning_effort="medium",
)
print(resp.choices[0].message.content)

About GLM-5.1

  • Building on GLM-5, it emphasizes an experiment-analyze-optimize loop rather than single-pass generation, enabling autonomous exploration, continuous improvement, and stable delivery in complex engineering environments.
  • Z.AI's framing of the upgrade is about endurance rather than peak ability: where the previous release plateaus early in an agentic loop, GLM-5.1 is documented as sustaining optimization over hundreds of rounds and thousands of tool calls, with better judgment on ambiguous problems.
  • The model offers a 200K context window with up to 128K output tokens, plus thinking modes and function calling.
  • Named workloads run beyond code to general dialogue, creative writing, front-end and artifact generation, and office productivity.
  • Thinking is switched through the same thinking object as the rest of the line and defaults to letting the model decide, with the trace returned in a separate reasoning_content field; note that the reasoning-effort control Z.AI later added is documented as GLM-5.2-only, so this model has no effort dial.
  • MCP tools, streaming, JSON output and automatic prefix caching are all supported, and weights are published under the MIT License.
  • Synthorai exposes GLM-5.1 behind its OpenAI-compatible endpoint for drop-in integration.

FAQ

Is the GLM-5.1 API free to try?

Yes: new accounts get 10 trial calls and up to $1 in free credit, no card required. At $1.4/M input tokens, that credit alone covers roughly 89 requests of ~8K tokens against GLM-5.1.

What is GLM-5.1 best at?

Works autonomously up to 8 hours; experiment-analyze-optimize loop over single-pass generation; covers planning through testing and delivery. See the About section for the full picture from the vendor's own release notes.

How much does GLM-5.1 cost?

GLM-5.1 costs $1.4 per million input tokens and $4.4 per million output tokens on Synthorai. That is the provider's list price, with no platform markup. Cached input tokens bill at $0.26/M.

What is GLM-5.1's context window?

GLM-5.1 has a context window of 203K tokens on Synthorai. A single response can be up to 131,072 tokens long.

Does GLM-5.1 support prompt caching?

Yes, automatically: Z.ai-served prompts cache with no code changes. Cached input tokens bill at $0.26/M vs $1.4/M uncached. Prompt caching guide →

How do I get access to GLM-5.1?

Point your existing OpenAI SDK at base_url="https://synthorai.io/v1", set model="glm-5.1", and you're done. One API key covers every model on the gateway.

Is GLM-5.1 open source?

Yes: the weights are published under the MIT license. Or skip the GPUs: the hosted version here is pay-as-you-go with no infrastructure to run. Running open-weight models →

Related models

Compare

Every value on this page is transcribed from the vendor's own documentation, linked above, and carries the date it was checked. Prices are compared across the catalogue; specification values that vendors define differently are shown with the difference stated rather than charted. Nothing here is measured by us, and nothing is scored.

Get your API key Compare your cost →