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.
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...
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
Pythonimport 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
| Benchmark | Score | Notes |
|---|---|---|
| Terminal-Bench 2.1 | 81.0 | Open-weight leader; within 4 points of Claude Opus 4.8 (85.0), ahead of Gemini 3.1 Pro (74.0) |
| SWE-bench Pro | 62.1 | Beats GPT-5.5 (58.6) and GLM-5.1 (58.4); trails Claude Opus 4.8 (69.2) |
| FrontierSWE | 74.4 | Trails Claude Opus 4.8 by 1 point (75.1); beats GPT-5.5 (72.6) |
| Artificial Analysis Intelligence Index v4.1 | 51 | Ranks as leading open-weights model; comparable to frontier proprietary models |