Skip to content
Dashboard

GLM 5.2

GLM 5.2 is Z.AI's flagship open-weight model for long-horizon coding and agentic engineering, released June 16, 2026. A 1.0M tokens context window carries project-level engineering state, and selectable reasoning effort tunes depth per request.

ReasoningTool UseImplicit Caching
index.ts
import { streamText } from 'ai'
const result = streamText({
model: 'zai/glm-5.2',
prompt: 'Why is the sky blue?'
})

Playground

Try out GLM 5.2 by Z.AI. Usage is billed to your team at API rates. Free users (those who haven't made a payment) get $5 of credits every 30 days.

zai logo
zai logo

GLM 5.2

Providers

Route requests across multiple providers. Copy a provider slug to set your preference. Visit the docs for more info. Using a provider means you agree to their terms, listed under Legal.

Provider
Context
Max Output
Latency
Throughput
Input
Output
Cache
Web Search
Capabilities
ZDR
No Training
Regional Inference
Release Date
Z.AI
Legal:Terms
Privacy
1M128K
5.4s
82tps
$1.40/M
$4.40/M
Read:$0.26/M
Write:
06/16/2026
Baseten
Legal:Terms
Privacy
1M128K
1.2s
99tps
$1.50/M
$4.50/M
Read:$0.3/M
Write:
US
06/16/2026
Fireworks
Legal:Terms
Privacy
1M128K
1.7s
70tps
$1.40/M
$4.40/M
Read:$0.26/M
Write:
06/16/2026
Wafer
Legal:Terms
Privacy
1M128K
2.2s
119tps
$3/M
$10.25/M
Read:$0.5/M
Write:
06/16/2026
DeepInfra
Legal:Terms
Privacy
1M128K
0.6s
50tps
$0.95/M
$3/M
Read:$0.18/M
Write:
06/16/2026
Parasail
Legal:Terms
Privacy
262K128K
0.6s
100tps
$1.40/M
$4.40/M
Read:$0.26/M
Write:
06/16/2026
Together AI
Legal:Terms
Privacy
256K128K
0.4s
160tps
$1.40/M
$4.40/M
Read:$0.26/M
Write:
06/16/2026
StreamLake
Legal:Terms
Privacy
1M128K
1.2s
102tps
$1.40/M
$4.40/M
Read:$0.26/M
Write:
06/16/2026
Novita AI
35% off
Legal:Terms
Privacy
1M128K
9.7s
45tps
$1.40/M$0.90/M
$4.40/M$2.84/M
Read:$0.26/M$0.17/M
Write:
06/16/2026
Alibaba Cloud
Legal:Terms
Privacy
1M128K
4.4s
92tps
$1.10/M
$3.85/M
Read:$0.28/M
Write:
06/16/2026
Morph
Legal:Terms
Privacy
1M128K
0.8s
57tps
$1.10/M
$4.10/M
06/16/2026
Crusoe
Legal:Terms
Privacy
262K128K
0.5s
434tps
$1.40/M
$4.40/M
Read:$0.26/M
Write:
06/16/2026
DigitalOcean
Legal:Terms
Privacy
262K52K
4.0s
568tps
$1.05/M
$4.40/M
Read:$0.21/M
Write:
06/16/2026
Nebius
Legal:Terms
Privacy
1M1M
218tps
$1.40/M
$4.40/M
06/16/2026
Throughput

P50 throughput on live AI Gateway traffic, in tokens per second (TPS). Visit the docs for more info.

Latency

P50 time to first token (TTFT) on live AI Gateway traffic, in milliseconds. View the docs for more info.

Uptime

Direct request success rate on AI Gateway and per-provider. Visit the docs for more info.

More models by Z.AI

Model
Context
Latency
Throughput
Input
Output
Cache
Web Search
Capabilities
Providers
ZDR
No Training
Release Date
1M
1.3s
197tps
$2.10/M
$6.60/M
Read:$0.21/M
Write:
fireworks logo
wafer logo
06/23/2026
205K
0.6s
115tps
$1.30/M
$4.30/M
Read:$0.26/M
Write:
baseten logo
deepinfra logo
fireworks logo
+3
04/07/2026
203K
4.4s
40tps
$1.20/M
$4/M
Read:$0.24/M
Write:
zai logo
03/15/2026
203K
0.2s
157tps
$0.80/M
$2.56/M
Read:$0.16/M
Write:
baseten logo
bedrock logo
deepinfra logo
+3
02/12/2026
205K
0.1s
460tps
$2.25/M
$2.75/M
Read:$2.25/M
Write:
baseten logo
bedrock logo
cerebras logo
+3
12/22/2025
128K
0.8s
77tps
$0.20/M
$1.10/M
Read:$0.03/M
Write:
zai logo
07/28/2025

About GLM 5.2

GLM 5.2 was released June 16, 2026 as Z.AI's flagship model for long-horizon tasks, with weights published under the MIT License. GLM 5.2 succeeds GLM-5.1 and extends the context window to 1.0M tokens, up from 200K on GLM-5.1, so a single task can hold an entire project's code, history, and instructions.

The architecture is Mixture-of-Experts, activating roughly 40B parameters per token. An IndexShare sparse-attention design reuses the same indexer across every four sparse attention layers, cutting per-token compute by roughly 2.9 times at full context length. You control depth per request: toggle thinking on or off, and set a reasoning effort level up to max to trade latency and token budget for stronger results on hard problems.

The focus is agentic software engineering: codebase takeover, long-horizon refactoring, end-to-end feature work, and research reproduction. GLM 5.2 scores 81.0 on Terminal-Bench 2.1 and 62.1 on SWE-bench Pro in Z.AI's published evaluations, ahead of GLM-5.1 on both. Treat the numbers as vendor-reported until independent results accumulate.

Through AI Gateway, you call GLM 5.2 with a single API key using the AI SDK, the Chat Completions API, the Responses API, the Messages API, or other API formats. Built-in observability, provider routing, and failover come standard, and GLM 5.2 supports tool calling, structured output, streaming, and implicit caching.

What To Consider When Choosing a Provider

  • Configuration: Reasoning effort is the main dial. Higher effort improves results on hard, multi-step problems but consumes more tokens and time. Start at a moderate setting, then raise it only for tasks that need deep deliberation.
  • Configuration: A 1.0M tokens window invites large prompts, and large prompts cost tokens on every request. Structure long-running agents to reuse stable context so implicit caching keeps repeat reads cheap, and watch spend in AI Gateway's observability tools.
  • Configuration: Published benchmark numbers come from Z.AI's own evaluations. Run GLM 5.2 on your own tasks before standardizing on it, and keep code review in the loop for anything headed to production. If per-step latency dominates your workload, glm-5.2-fast serves the same weights on faster infrastructure.
  • Zero Data Retention: AI Gateway supports Zero Data Retention for this model via direct gateway requests (BYOK is not included). To configure this, check the documentation.
  • Authentication: AI Gateway authenticates requests using an API key or OIDC token. You do not need to manage provider credentials directly.

When to Use GLM 5.2

Best for

  • Long-Horizon Coding Agents: Multi-step engineering tasks that require planning, editing, testing, and iterating without losing the thread
  • Project-Scale Refactors: Whole-repository context held in a single window instead of chunked retrieval
  • Codebase Takeover: Onboarding onto an unfamiliar project by loading its code and history at once
  • Adjustable Reasoning Depth: One model covering both quick edits and deep deliberation via effort settings
  • Agentic Tool Use: Reliable function calling and structured output across long tool-call chains

Consider alternatives when

  • Latency-Sensitive Loops: glm-5.2-fast serves the same weights on faster infrastructure for interactive agents
  • High-Volume Lightweight Tasks: GLM-5-Turbo handles extraction and classification at lower per-token cost
  • Vision or GUI Input: GLM-5V-Turbo adds screenshot and image understanding to the GLM-5 generation
  • Simple Short Prompts: GLM-4.7-Flash keeps costs down when project-scale context is unnecessary

Conclusion

GLM 5.2 makes long-horizon, project-scale engineering practical with open weights, a 1.0M tokens context window, and tunable reasoning effort. Route GLM 5.2 through AI Gateway to get unified access, observability, and provider failover, and pair it with glm-5.2-fast when response speed outweighs per-token cost.