GLM-5.2
Z.ai's MIT-licensed 1M-context coding model, succeeded by GLM-5.3 in August 2026
Z.ai (Zhipu AI) has replaced this model with GLM-5.3.
Context window
1M
Input / 1M tokens
$1.40
Output / 1M tokens
$4.40
Provider
Z.ai (Zhipu AI)
Z.ai API list price; cached input $0.26 per 1M. GLM-5.3 costs the same. · Data verified 2026-11-08
GLM-5.2 is a 753B-parameter Mixture-of-Experts model from Zhipu AI (Z.ai), released June 16, 2026 under the MIT license. Built for coding and agentic workflows, it has a 1-million-token context window (5x GLM-5.1), up to 128K output tokens, and IndexShare sparse attention that reduces per-token FLOPs by 2.9x at 1M context. At launch it led open-weight models on several coding benchmarks. GLM-5.3 (August 14, 2026), a post-trained version of the same base model, replaced it as Z.ai's flagship at the same $1.40/$4.40 price. GLM-5.2 stays in the API; its plain MIT license and the option to switch reasoning off are the main reasons to still pick it.
Capability index
Relative estimates (0-100) to place this model against its peers, grounded in published benchmarks.
How to access it
Z.ai API (model glm-5.2), OpenRouter and other inference providers, and MIT open weights on Hugging Face (zai-org/GLM-5.2).
Strengths
- ✓81.0 on Terminal-Bench 2.1 and 62.1 on SWE-bench Pro (Z.ai-reported)
- ✓1M-token context window enables repository-scale engineering without truncation
- ✓MIT licensed open weights with no regional restrictions
- ✓Thinking can be switched off for fast answers, unlike GLM-5.3
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
- →You need a plain MIT license (GLM-5.3 uses a custom license)
- →You want to turn reasoning off for low-latency calls
- →You want open weights for self-hosting or fine-tuning
- →You're in a region where proprietary model access is restricted
Look elsewhere if...
- ✕You want Z.ai's strongest coding model at the same price (choose GLM-5.3)
- ✕You need vision/multimodal input (text-only model; GLM-5.3-Flash is multimodal)
- ✕General-purpose chat and reasoning is your primary use case
- ✕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 model glm-5.2; the 1M context needs no separate model name
- ›Set thinking.type to 'disabled' for quick answers; keep it enabled with reasoning_effort 'max' for complex coding
- ›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): cached input costs $0.26 per 1M instead of $1.40
Quickstart
Pythonimport openai
client = openai.OpenAI(
api_key='your-z-ai-key',
base_url='https://api.z.ai/api/paas/v4/'
)
response = client.chat.completions.create(
model='glm-5.2',
messages=[{'role': 'user', 'content': 'refactor this repo...'}]
)
print(response.choices[0].message.content)Base URL from Z.ai's docs. Thinking is on by default; pass extra_body={'thinking': {'type': 'disabled'}} to turn it off.
API model id: glm-5.2
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 |
Compare GLM-5.2
Compare GLM-5.2 with any other model
Build a comparison →All model comparisons →