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

GLM-5.2

Released 2026-06-16

chatCodeReasoningTool callingPrompt caching

GLM-5.2 is Z.AI's flagship model built for the era of long-horizon tasks, extending the context window to 1M tokens with up to 128K output; the docs stress making 1M context truly usable for project-scale work.

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

Benchmarks

Above averageNo peer higher26 / 701 / 70
GLM-5.2 other models measured peer average no peer scored higher
SWE-Bench Pro
62.1%
GDPval-AA v2 Elo · 642-1861
1510
Harvey Lab-AA
91%
GPQA Diamond
91.2%
MCP-Atlas
82.6%

Vendor-published: Alibaba (Qwen) Anthropic ByteDance DeepSeek Google MiniMax Moonshot OpenAI Tencent Z.ai

Price in context

Where the price sits among 60 comparable models

Input$1.4/M
$0.05 · Qwen3 VL Flash GPT-5.4 Pro · $30
Output$4.4/M
$0.275 · DeepSeek V4 Flash GPT-5.4 Pro · $180
Cached read$0.26/M
$0.0028 · DeepSeek V4 Flash 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) 1,000,000
Max output (vendor spec) 131,072

Prompt caching

How it caches automatic

Thinking

Vendor control thinking.type + reasoning_effort
Accepted values thinking.type enabled · disabled; reasoning_effort none · minimal · low · medium · high · xhigh · max (none and minimal skip thinking, low and medium map to high, xhigh maps to max)
Default enabled, with reasoning_effort at max: the only GLM with an effort dial, and it defaults to the top of it 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 on the standard API endpoint, and thinking blocks must be returned with tool results for interleaved thinking to work.
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

Long-horizon flagship (744B-A40B) with usable 1M-token context / 128K max output, configurable thinking-effort levels, and IndexShare sparse-attention efficiency at 1M context.

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.2 passed · 3 sentences

Enabling reasoning means the LLM now generates thousands of invisible "thinking" tokens to systematically work through complex problems before producing a final answer. Because our cloud providers bill for these internal processing steps at the same rate as standard output, our billable token volume per query has doubled. While this increases our direct API costs, it drastically reduces error rates and manual review labor, ultimately lowering our total cost per resolved transaction.

out 1223 tok (+1138 thinking) latency 17.1 s

Instruction following (exactly three sentences - 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.2 missed · 1/8 cases (fails [1])

```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 […]

out 4097 tok (+4036 thinking) latency 58.4 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.2 passed · 5/5 fields, guidance "withheld"

```json { "company": "Meridian Robotics", "quarter": "September quarter", "revenue_usd_m": 412, "growth_pct": 11, "guidance": "withheld" } ```

out 1947 tok (+1893 thinking) latency 30.9 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.2 passed · 120 words, 0 banned, 1 question

We are introducing Caching for our API Gateway, the smartest way to optimize your workflows. Why pay for the exact same response twice? Now, you can automatically store and reuse prompt results across multiple AI providers, drastically reducing latency and overall operational costs. If a user submits a duplicate query, the gateway serves the cached answer instantly, regardless of whether you route to OpenAI, Anthropic, or others. This directly translates to faster applications and significantly lower monthly API bills. You can easily configure your specific caching rules within the developer dashboard and watch your efficiency soar. Stop wasting your valuable tokens on completely redundant computations. Upgrade to the latest gateway version today and experience the future of intelligent prompt management.

out 11125 tok (+10984 thinking) latency 114.8 s

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

Use GLM-5.2 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.2",
    messages=[{"role": "user", "content": "Summarize this diff"}],
    reasoning_effort="medium",
)
print(resp.choices[0].message.content)

About GLM-5.2

  • Over GLM-5.1, the official page highlights more stable long-horizon task execution, stronger consistency in following engineering standards across extended contexts, project-scale understanding with multi-file refactoring, and complete on-device debugging loops for mobile and client development, alongside mini-program and small-game development and research reproduction.
  • The efficiency behind the longer window is published too: an IndexShare scheme lets one lightweight indexer serve every four transformer layers, cutting per-token compute at 1M context, with an improved multi-token-prediction layer raising speculative-decoding acceptance.
  • This is also the only model in the line with a reasoning_effort control, a documented set of levels that collapse in practice to skipping thinking, a high setting, and a maximum setting, with the hosted API defaulting to the maximum, so a request that sets nothing is a request that thinks hard.
  • Thinking otherwise behaves as elsewhere in the GLM-5 line, returning its trace in a separate field, and tool calling, MCP, JSON output and automatic caching carry over.
  • Weights are MIT-licensed.
  • When you call GLM-5.2 on Synthorai, the OpenAI-compatible endpoint makes it a drop-in upgrade for long-context agent workloads.

FAQ

Is the GLM-5.2 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.2.

What is GLM-5.2 best at?

Context extended to 1M usable tokens; project-scale understanding with multi-file refactoring; on-device debugging loops for mobile development. See the About section for the full picture from the vendor's own release notes.

How much does GLM-5.2 cost?

GLM-5.2 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.

Does GLM-5.2 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.2?

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

Is GLM-5.2 open source?

Yes: the weights are published under the MIT license (official repository linked in the About section). 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 →