Open SourceZhipu AI / Z.aiReleased 2026-06

GLM-5.2

Open-weights flagship model for long-horizon coding and agentic tasks with 1M-token context

Context window

1M

Input / 1M tokens

$1.40

Output / 1M tokens

$4.40

Provider

Zhipu AI / Z.ai

Data verified 2026-07-07

GLM-5.2 is a 753B-parameter Mixture-of-Experts model from Zhipu AI released June 13-16, 2026 under MIT license. Built specifically for coding and agentic workflows, it features a usable 1-million-token context window (5x GLM-5.1), flexible reasoning effort levels (High/Max), and architectural innovations like IndexShare sparse-attention that reduce per-token FLOPs by 2.9x at 1M context. It ranks as the strongest open-weight model on coding benchmarks and matches or exceeds closed-source models like GPT-5.5 on long-horizon tasks.

Capability index

Relative estimates (0-100) to place this model against its peers, grounded in published benchmarks.

Coding
9
Reasoning
8
Math
7
Multimodal
0
Long context
10
Speed
7
Cost efficiency
9

How to access it

Available via Z.ai GLM Coding Plan subscription (starting $18/month), standalone API at z.ai, OpenRouter, and 40+ other providers. Open weights available on HuggingFace under MIT license.

Strengths

  • Strongest open-weight model on coding benchmarks (81.0 Terminal-Bench, 62.1 SWE-bench Pro)
  • 1M-token context window enables repository-scale engineering without truncation
  • MIT licensed open weights with no regional restrictions
  • Flexible reasoning modes (High/Max) to balance capability vs latency
  • Roughly 1/6th cost of GPT-5.5 for equivalent long-horizon coding performance

Best for developers who...

Long-horizon coding and agentic automation tasksRepository-scale software engineering with full codebase contextMulti-file refactoring and complex engineering workflowsCost-sensitive teams running high-volume coding infrastructureSelf-hosted/on-premise AI deployments requiring frontier performance

When to choose it (and when not to)

Reach for GLM-5.2 when...

  • You need long context (1M tokens) for repository or documentation-scale work
  • Cost efficiency matters more than squeezing maximum capability
  • You want open weights for self-hosting or fine-tuning
  • Your workflow is agentic or requires multi-step reasoning over code
  • You're in a region where proprietary model access is restricted

Look elsewhere if...

  • You need vision/multimodal input (text-only model)
  • General-purpose chat and reasoning is your primary use case
  • You require maximum performance on single-shot hard reasoning (Claude Opus 4.8 still leads)
  • Your workloads are under 128K tokens (smaller models may be more cost-efficient)
  • You need guaranteed proprietary support and SLAs

How to use it

  • Use glm-5.2[1m] model identifier to activate full 1M context variant
  • Set reasoning effort to 'max' for complex multi-step coding; 'high' for faster, everyday tasks
  • Load entire repositories or documentation into context without chunking—the model is built for this
  • Use prompt caching for repeated context (e.g., same codebase queries) to reduce costs 80%+

Quickstart

Python
import openai
client = openai.OpenAI(
    api_key='your-z-ai-key',
    base_url='https://api.z.ai/api/coding/paas/v4'
)
response = client.chat.completions.create(
    model='glm-5.2[1m]',
    messages=[{'role': 'user', 'content': 'refactor this repo...'}]
)
print(response.choices[0].message.content)

Requires Z.ai API key from docs.z.ai or GLM Coding Plan subscription. Set reasoning_effort='max' for complex tasks.

API model id: glm-5.2 or glm-5.2[1m]

Benchmarks

BenchmarkScoreNotes
Terminal-Bench 2.181.0Open-weight leader; within 4 points of Claude Opus 4.8 (85.0), ahead of Gemini 3.1 Pro (74.0)
SWE-bench Pro62.1Beats GPT-5.5 (58.6) and GLM-5.1 (58.4); trails Claude Opus 4.8 (69.2)
FrontierSWE74.4Trails Claude Opus 4.8 by 1 point (75.1); beats GPT-5.5 (72.6)
Artificial Analysis Intelligence Index v4.151Ranks as leading open-weights model; comparable to frontier proprietary models

Source: Z.ai Official Docs + Artificial Analysis

Learn the concepts