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?'
})

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.