Z.AI
GLM-5.2 (max)
Released 
June 2026

Z.AI
GLM-5.2 (max)

Open-weight 1M-context MoE model built for repo-level coding agents and long-horizon engineering tasks.

Modality:
Text
Video
PDF
model ID
z-ai/glm-5.2

Output Speed *

72.20
tok/s

Intelligence Index *

34
/ 100

Context Window *

1048576
tokens

Input price

8.4
Anytoken

Output price

26.4
Anytoken
GLM 5.2: Open-Weight Coding at 1M-Token Context GLM 5.2 is Z.AI's open-weight flagship, a mixture-of-experts model released in June 2026 under the MIT license and positioned above GLM-5.1 in the GLM lineup. It pairs a 1M-token context window with strong coding and tool-use performance, making it built for long-horizon engineering: whole-repository refactors, API migrations, and multi-step agent trajectories that need to keep architectural context in a single session. It supports text input and output only, with configurable reasoning effort to trade throughput against depth. The workload that benefits most is repo-level coding agents. Start building with the GLM 5.2 API on AnyAPI.ai.

Performance

Why GLM 5.2 Holds Up on Long-Horizon Coding

GLM 5.2 is strongest on extended, engineering-grade coding tasks that span multiple files and many steps. On Z.ai's reported results it scores 62.1 on SWE-bench Pro and 81.0 on Terminal-Bench 2.1, the latter a large jump over GLM-5.1. Those numbers matter because they measure real GitHub-issue edits and terminal task completion, not synthetic puzzles. The practical consequence is that GLM 5.2 can sustain a full development workflow — audit, plan, implement, verify — inside one 1M-token session, reducing context fragmentation. As an open-weight MoE, it also occupies a lower-cost tier than closed frontier coding models.

Benchmarks

GLM 5.2 Coding Benchmarks: What Third Parties Confirm

GLM 5.2's headline coding scores are Z.ai-reported: 62.1 on SWE-bench Pro and 81.0 on Terminal-Bench 2.1. Independent evaluators including Artificial Analysis and Scale AI treat it as competitive rather than reproducing exact point scores. Reads differ on how close it sits to the frontier: on FrontierSWE it scores 74.4 against Opus 4.8's 75.1, effectively near-parity, but on SWE-bench Pro Opus 4.8 (69.2) leads more clearly. Treat parity claims as benchmark-specific. One documented gotcha: GLM 5.2 is verbose, emitting far more reasoning tokens per task than GPT-5.5, which narrows its per-task cost advantage.

Output Speed

*
72.20
tok/s

Intelligence Index

*
34
/ 100

MMLU *

Broad world knowledge and problem-solving
0
%

GPQA *

PhD-level scientific reasoning across physics, biology, chemistry.
90
%

HLE *

Adherence to multi-step structured instructions.
41
%

LiveCodeBench *

Tool-calling reliability in long agentic loops.
0
%

Technical Specifications

What the model supports

GLM 5.2 is a text-in, text-out mixture-of-experts model with a 1,048,576-token context window and up to 131,072 output tokens. The two specifications with the greatest production impact are the 1M context and the configurable reasoning effort (high and xhigh). The large window lets an agent hold full-repository context without repeated retrieval, but does not guarantee reliable recall across every token. Reasoning-effort control lets teams dial between latency and depth per request. It exposes function calling and JSON-schema structured outputs over an OpenAI-compatible API, and ships as open weights under the MIT license.
Verified Specifications — 
GLM-5.2 (max)
*
Input modalities
Text
Video
PDF
output modalities
Text
Context window
1048576
 tokens
Maximum output tokens
131072
Reasoning
Yes
Knowledge cutoff
June 2026
Pricing (standard)
8.4
 AnyTokens in
 / 
26.4
 AnyTokens out

Comparison

GLM 5.2 vs GLM-5.1: What Changes for Coding Agents

GLM 5.2 is the direct successor to GLM-5.1 and shares its MoE architecture and OpenAI-compatible wire format, so migration is mostly a model-ID swap. Both target coding and long-horizon agentic work. The practical decision is whether the newer generation's larger context and higher coding scores justify moving. GLM 5.2 expands the usable context roughly fivefold to 1M tokens, adds the IndexShare sparse-attention scheme to cut long-context cost, and posts clearly higher coding numbers — notably Terminal-Bench 2.1 jumping from around 62–63 to 81.0, alongside a step up on SWE-bench Pro.

Dimension
GLM-5.2 (max)
GPT-5.1 (high)
Context window *
1048576
tokens
400000
tokens
Output speed *
72.20
tok/s
0.00
tok/s
Intelligence Index *
34
24.7
Input pricing
8.4
AnyToken
7.5
AnyToken
Output pricing
26.4
AnyToken
60
AnyToken
Knowledge cutoff *
June 2026
November 2025

Choose GLM 5.2 when your workload needs whole-repository context in a single pass, long-running agent trajectories, or the strongest available GLM coding performance — repo migrations, cross-file refactors, and multi-platform builds. Choose GLM-5.1 when your tasks fit comfortably within a ~200K window, you have already tuned prompts and cost around it, and you do not need the extra context or the newer coding gains. GLM 5.2's higher verbosity also means more reasoning tokens per task, so 5.1 may remain cheaper for shorter, well-bounded jobs.

Limitations & Trade-offs

Where GLM-5.2 (max) falls short

1
High output verbosity. GLM 5.2 emits substantially more reasoning tokens per task than comparable models — independent testing found roughly 43K output tokens per benchmark task, about 37K of them pure reasoning, versus around 16K for GPT-5.5. This inflates effective cost-per-task well above what the low per-token price suggests, and increases latency on complex work. For high-volume or latency-sensitive generation, a less verbose model or a lower reasoning-effort setting is preferable.
2
Text-only modalities. GLM 5.2 accepts text input and produces text output only. It has no verified image, audio, video, or document-vision input in the API model. Workloads involving screenshots, diagrams, UI mockups, or scanned documents need a separate multimodal model. If your coding agent depends on visual inputs, GLM 5.2 alone will not cover the pipeline.
3
Long context is not perfect recall. The 1M-token window lets GLM 5.2 hold large projects, but a large window does not guarantee reliable reasoning or recall over every token. Long prompts can still contain conflicting instructions, stale files, or irrelevant context that degrade output. For high-stakes retrieval, verify cited facts and consider structured chunking rather than trusting whole-context recall.
4
Frontier coding gaps remain benchmark-specific. GLM 5.2 leads open-weight coding but does not universally match the closed frontier. On SWE-bench Pro it trails Opus 4.8 (62.1 vs 69.2), and independent reporting notes weaker deep-reasoning and tool-scheduling relative to top proprietary models. Near-parity claims hold only on specific benchmarks like FrontierSWE. For the hardest multi-file editing or deep reasoning, a leading closed model may still outperform it.

Best-Fit Workloads

Where this model earns its place

01

Repo-Level Coding Agents


GLM 5.2's core fit. The 1M-token context lets an agent hold an entire codebase — backend, frontend, config, tests, and conventions — while it audits architecture, plans changes, implements across files, and verifies. Z.ai reports it tracks cross-file dependencies in a single pass, enabling whole-repo refactors without repeated retrieval. Strong SWE-bench Pro and Terminal-Bench scores back the coding focus. Still pair generated changes with tests, review, and sandboxing.

02

Codebase Migration and Refactoring


GLM 5.2 is designed for cross-file, multi-step, long-chain tasks: module decoupling, API migration, directory restructuring, SDK adaptation, and cross-language refactoring. It decomposes the goal, identifies dependencies and risks, then implements and closes work in stages while preserving API contracts and engineering standards. The large context reduces fragmentation across a migration. Budget for its verbosity on long sessions, and gate all changes behind CI and human review.

03

Long-Horizon Agent Automation

For multi-step automation that needs task decomposition, intermediate verification, and observable progress, GLM 5.2 exposes reasoning-effort control, streaming, tool streaming, and function calling. That combination suits agent systems that must maintain state and standards across long-running trajectories. Set xhigh effort for complex sessions and lower effort for routine steps to manage cost and latency, and validate tool outputs before acting on them.

04

Long-Document and Repository Analysis

The 1M-token window makes GLM 5.2 usable for inspecting large design documents, technical specifications, logs, or full repositories together, reducing the need for aggressive chunking. This helps architecture audits and cross-document reasoning. Because a large window does not remove hallucination risk, verify extracted facts against source and prefer schema-validated structured outputs for downstream data.

Pricing in anytokens via AnyAPI
Input
8.4
Output
26.4
Cache write
Cache read

Integration

Access GLM-5.2 (max) via AnyAPI.ai

Access GLM-5.2 (max) through AnyAPI.ai using a unified API built for multi-model AI applications. Integrate GLM-5.2 (max) without maintaining a separate provider-specific connection, and keep the flexibility to test, switch, or combine models as your application requirements evolve.

01

One API integration

Access GLM-5.2 (max) and other AI models through the same API workflow instead of maintaining separate integrations for every provider.

02

Easy model switching

Test GLM-5.2 (max) against alternative models or switch models as your performance, capability, or cost requirements change without rebuilding your application around another provider API.

03

Flexible for production

Use GLM-5.2 (max) from experimentation through production while keeping your AI stack flexible as workloads, traffic, and model requirements evolve.

04

Multi-model applications

Use GLM-5.2 (max) for the workloads where it performs best and combine it with other models for tasks that require different capabilities, performance, or efficiency.

Frequently Asked Questions

Answers to common questions about integrating and using this AI model via AnyAPI.ai

GLM 5.2 is Z.AI's open-weight flagship built for long-horizon coding: repo-level coding agents, whole-repository refactors, API and SDK migrations, long-horizon agent automation, and long-document analysis. Its 1M-token context and strong coding benchmarks make it well suited to multi-file, multi-step engineering tasks that need consistent context across a full workflow.

GLM 5.2 has a 1,048,576-token (~1M) context window and supports up to 131,072 output tokens (about 128K max completion). The context is roughly five times larger than GLM-5.1's and uses the IndexShare sparse-attention scheme to reduce per-token cost at long context. A large window does not guarantee perfect recall across every token.

Yes. GLM 5.2 is released as open weights on Hugging Face under the MIT license, so it can be self-hosted or accessed via hosted APIs. It accepts tools and tool_choice for function calling, supports tool streaming, and provides structured outputs via a JSON schema in response_format over an OpenAI-compatible interface.

GLM 5.2 leads open-weight coding benchmarks and is competitive with the closed frontier, but the gap is benchmark-specific. Z.ai reports 62.1 on SWE-bench Pro, ahead of GPT-5.5's 58.6 but behind Claude Opus 4.8's 69.2. On FrontierSWE it is near-parity with Opus 4.8. For the hardest deep reasoning, top proprietary models can still lead.

No. The GLM 5.2 API model is text input and text output only. It has no verified image, audio, video, or document-vision input. Workloads that need visual or audio inputs — such as screenshots, diagrams, or UI mockups — require a separate multimodal model in your pipeline.

* Benchmark data source: Artificial Analysis artificialanalysis.ai