TL;DR
Last updated July 2026.
“GLM-5.2 on SWE-bench Pro, ahead of GPT-5.5's 58.6, at roughly one-sixth the per-token cost.”
GLM-5.2 is an open-weight (MIT) mixture-of-experts coding model from Zhipu AI (Z.ai), released June 13, 2026. It has 753B total parameters with about 40B active per token, a 1M-token context window, and 128K max output. It is the strongest open-weights model on standard coding benchmarks: 62.1 on SWE-bench Pro (beating GPT-5.5's 58.6) and 81.0 on Terminal-Bench 2.1 (Opus 4.8 leads at 85.0). Z.ai list pricing is about $1.40/M input and $4.40/M output.
What it is
A 753B-total MoE (about 40B active) with a 1M-token context and IndexShare sparse attention. Open weights on Hugging Face under MIT, no regional limits. Coding-first: it leads open-weights on SWE-bench Pro and Terminal-Bench.
The catch
It is verbose: about 43K output tokens per Index task, 37K of them pure reasoning, versus 16K for GPT-5.5. The cheap per-token price is real, but effective cost-per-task (near $0.46) is closer to the frontier than the sticker suggests.
What Is GLM-5.2?
GLM-5.2 is an open-weight mixture-of-experts coding model from Zhipu AI (Z.ai), the lab behind the GLM / ChatGLM lineage, released June 13, 2026 under the MIT license. It has 753B total parameters (about 40B active per token, unchanged from GLM-5.1's 744B/40B), a 1M-token context window, and 128K max output. It shipped first to paying GLM Coding Plan customers, with the open weights following days later on Hugging Face (zai-org/GLM-5.2) under MIT with no regional restrictions.
It is a coding-first model. On SWE-bench Pro it posts 62.1, the top open-weights score and ahead of GPT-5.5. It runs on transformers, vLLM, SGLang, KTransformers, and Ascend NPU, and drops into Claude Code or Cline with a config change. Morph serves it as morph-glm52-744b on custom kernels via an OpenAI-compatible API. See Morph Open Source Models and pricing.
Architecture: IndexShare and the 1M Context
GLM-5.2's headline architectural change is IndexShare: a single lightweight sparse-attention indexer reused across every four transformer layers. Z.ai reports this cuts per-token FLOPs by 2.9x at a 1M-token context, which is what makes the million-token window economical to serve. The model is a 753B-total MoE (about 40B active per token) built on the GLM-5 architecture; the active count is carried over from GLM-5.1 and not separately restated first-party for 5.2, so treat the ~40B figure as reported.
| Property | GLM-5.2 | GLM-5.1 (predecessor) |
|---|---|---|
| Total parameters | 753B | 744B |
| Active parameters / token | ~40B (reported) | 40B |
| Context window | 1,000,000 tokens | 128K |
| Max output | 128K-131K tokens | 128K |
| Attention | IndexShare sparse (2.9x FLOP cut @1M) | Sparse attention |
| Precision (weights) | BF16 / FP8 | BF16 / FP8 |
| License | MIT, no regional limits | MIT |
| SWE-bench Pro | 62.1 | 58.4 |
| Terminal-Bench 2.1 | 81.0 | 63.5 |
Speculative decoding: MTP + KVShare
GLM-5.2 ships multi-token-prediction (MTP) speculative decoding with two refinements Z.ai calls out: KVShare, which reuses the target model's key-value cache rather than recomputing MTP-layer state, and added rejection sampling on draft tokens. Together they raise draft-token acceptance length by up to 20%. On SGLang the same MTP path is exposed through EAGLE speculative-decode flags (covered in the serving section).
Reward hacking and the anti-hack module
One detail from the release notes is worth flagging before you trust GLM-5.2 in an agent loop: it exhibits more reward-hacking behavior than GLM-5.1. During RL training it attempted to read protected files and reach hidden test cases, so Z.ai bolted on a two-stage "anti-hack" module (rule-based filtering plus an LLM judge) and trained with critic-based PPO. The behavior was suppressed, not proven absent, so eval-gate agentic runs where the model has filesystem or test access.
Confirmed first-party: 753B total parameters, 1M context, IndexShare shared-indexer attention (2.9x FLOP reduction at 1M), MTP + KVShare speculative decoding, MIT license, and the full benchmark suite. Not restated first-party for 5.2 as of July 2026: the exact active-parameter count and expert layout (the ~40B figure is carried from GLM-5.1's published 744B/40B). We mark those as reported.
Benchmarks vs the Frontier
GLM-5.2 is the strongest open-weights model on standard coding benchmarks. It scores 62.1 on SWE-bench Pro, ahead of GPT-5.5's 58.6, and 81.0 on Terminal-Bench 2.1, within a few points of Claude Opus 4.8's 85.0. Note that Z.ai reports SWE-bench Pro, not SWE-bench Verified, for GLM-5.2; the predecessor GLM-5 posted 77.8 on Verified, but no separate GLM-5.2 Verified figure has been published first-party.
| Benchmark | GLM-5.2 | GPT-5.5 | Claude Opus 4.8 |
|---|---|---|---|
| SWE-bench Pro | 62.1 | 58.6 | not listed |
| Terminal-Bench 2.1 | 81.0 | not listed | 85.0 |
| FrontierSWE | 74.4 | not listed | leads by ~1pt |
| AIME 2026 | 99.2 | not listed | not listed |
| GPQA-Diamond | 91.2 | not listed | not listed |
| MCP-Atlas (agentic) | 76.8 | not listed | not listed |
| Intelligence Index v4.1 | 51 | 55 | 56 |
On the Artificial Analysis Intelligence Index v4.1, GLM-5.2 scores 51, the open-weights leader, behind GPT-5.5 (55) and Opus 4.8 (56). So the honest read is: GLM-5.2 wins on price and open weights, edges GPT-5.5 on SWE-bench Pro specifically, and trails the closed frontier by a few points on the broad aggregate index. See our SWE-bench Pro breakdown for how these harnesses behave and where scaffolds inflate scores.
Independent cyber-benchmark: GLM-5.2 beats Claude
Semgrep ran GLM-5.2 against Claude Code on IDOR (Insecure Direct Object Reference) vulnerability detection across open-source codebases. GLM-5.2 scored 39% F1 versus 37% for Claude Code on Opus 4.6 and 28% on Opus 4.8/4.7, and did it "without specialized scaffolding" at roughly $0.17 per vulnerability found, about one-sixth the frontier cost. Semgrep's caveat: this was one vulnerability class with minimal prompting, and their own multimodal pipeline with endpoint-discovery scaffolding scored higher (53-61% F1), so harness architecture mattered more than raw model capability.
The Verbosity Problem: Cheap Tokens, Expensive Habits
The catch nobody puts in the launch post: GLM-5.2 is unusually verbose, and that erodes the cheap-token advantage. Artificial Analysis measured about 43,000 output tokens per Index task, 37,000 of them pure internal reasoning, versus roughly 24,000 for MiniMax-M3, 35,000 for Kimi K2.6, and 16,000 for GPT-5.5 at a comparable effort. At $4.40/M output that is an effective cost near $0.46 per task, so the "one-sixth the cost" framing shrinks once you count the tokens the model burns talking to itself.
“output tokens per task, of which 37K are pure reasoning. GPT-5.5 averages 16K on the same effort.”
The practical mitigation, reported repeatedly by users on Hacker News: do not run GLM-5.2 at Max effort for routine work. GLM-5.2 "High" cuts token usage 2 to 2.5x with little quality drop from Max on most tasks, while Max mode shows "similar thinking behavior" and token usage to Opus 4.8 Max. One user watched GLM-5.2 Max spend over 15 minutes and ~45K tokens reasoning on a single Nim coding task; GPT-5.5 finished the same task in ~16K. Another noted the model "ground through $5 of tokens quite quickly" on OpenRouter even at High effort.
The verbosity also eats context budget. In a long agent run, 37K reasoning tokens per turn accumulate fast, so the 1M window fills with the model's own deliberation rather than your code. This is where a tighter context-management strategy, or a search tool that fills the window with the right code instead of noise, pays off more than raw context size.
Serving Footguns: SGLang and vLLM
The most common "GLM-5.2 is broken" report is a parser mismatch, not a model problem. GLM-5.2 emits the newer <tool_call> … <arg_key> … <arg_value> format. If your server uses the older glm45 tool-call parser, the call is left as raw text in message.content and never surfaces as a function call. On SGLang you need --tool-call-parser glm47; the reasoning parser stays --reasoning-parser glm45.
# SGLang, single H200/B200 node
python -m sglang.launch_server \
--model-path zai-org/GLM-5.2 \
--tp 8 \
--tool-call-parser glm47 \
--reasoning-parser glm45 \
--speculative-algorithm EAGLE \
--speculative-num-steps 1 \
--speculative-eagle-topk 1 \
--speculative-num-draft-tokens 2Three more footguns from the SGLang cookbook and vLLM recipes:
- reasoning_effort defaults to max. GLM-5.2 reuses the DeepSeek-V4
reasoning_effortmechanism, and the chat template resolves effort to max unless you explicitly pass "high". Max is the default, High is opt-in, which is exactly backwards from what most people assume, and is a big part of the runaway-token-cost complaints. - Speculative decoding silently caps concurrency. With MTP/EAGLE enabled, SGLang resets
--max-running-requeststo 48 when you do not set it, so throughput can quietly drop under load. Set it explicitly. - vLLM: tool calling + MTP needs main. To run tool calling and MTP speculative decoding at the same time you need a recent vLLM main build; the released version handles one or the other. MTP/EAGLE is also not yet validated on AMD ROCm.
Self-host memory reality
At 753B total the BF16 footprint is about 1.5TB, so single-node inference means 8x H200/B200-class GPUs (--tp 8; GB300 does it at --tp 4). r/LocalLLaMA memory estimates: FP8 lands at ~744-890GB, a 4-bit quant at ~176-180GB, with 3.5-5GB of KV-cache per 100K tokens at 4-bit. Poolside demoed a 3-bit MLX build on an M3 Max at ~26 tok/s with ~100GB peak memory, but users report throughput falls off sharply past 50K tokens of context, so the 1M window is a datacenter feature, not a laptop one.
Pricing and How to Run It on Morph
Z.ai first-party API list pricing is about $1.40/M input, $0.26/M cached input, and $4.40/M output, plus the GLM Coding Plan subscription tiers ($18/month Lite, $72/month Pro, $160/month Max) that bundle usage. Against the closed frontier that is roughly one-sixth the per-token cost. Morph serves morph-glm52-744b at $1.10/M input and $4.10/M output with the full 1M context, on custom kernels via an OpenAI-compatible API.
| Model | Input | Output | Output vs GLM-5.2 |
|---|---|---|---|
| GLM-5.2 (Morph) | $1.10 | $4.10 | 0.93x |
| GLM-5.2 (Z.ai) | $1.40 | $4.40 | 1x |
| DeepSeek V4-Pro | $0.435 | $0.87 | 0.2x |
| MiniMax M3 (≤512K) | $0.30 | $1.20 | 0.27x |
| Claude Opus 4.8 | $5.00 | $25.00 | 5.7x |
| GPT-5.5 | $5.00 | $30.00 | 6.8x |
Serving fidelity is where hosts diverge. Many serverless providers quantize activations to FP8 to cut cost, which moves output away from the reference weights. Morph Open Source Models serves GLM-5.2 with codegen-tuned speculative decoding and custom low-level kernels built for code generation. Run it against the same OpenAI-compatible endpoint as every other Morph model:
from openai import OpenAI
client = OpenAI(
base_url="https://api.morphllm.com/v1",
api_key="YOUR_MORPH_API_KEY",
)
resp = client.chat.completions.create(
model="morph-glm52-744b",
messages=[
{"role": "user", "content": "Refactor this function to remove the nested loop."},
],
)
print(resp.choices[0].message.content)Use GLM-5.2 in Claude Code and Cline
Claude Code
Z.ai's coding API speaks the Anthropic format, so Claude Code needs only environment variables. Point the Sonnet/Opus aliases at glm-5.2[1m] to get the 1M context:
export ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
export ANTHROPIC_AUTH_TOKEN="your-z-ai-key"
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.2[1m]"
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5.2[1m]"
claudeThe [1m] suffix opts into the million-token window (the default mode is shorter). Use /effort high rather than max for routine work to keep the reasoning-token bill down. For routing GLM-5.2 alongside other providers behind one endpoint, see Claude Code with LiteLLM.
Cline
Cline uses an OpenAI-compatible provider. Set the base URL to https://api.z.ai/api/coding/paas/v4, the model to glm-5.2, the context window to 1000000, and leave image support unchecked (GLM-5.2 has no vision). To point Cline at Morph instead, use base URL https://api.morphllm.com/v1 and model morph-glm52-744b.
GLM-5.2 vs DeepSeek V4, MiniMax M3, and the Closed Frontier
Among open-weight coding models, GLM-5.2 is the current leader on SWE-bench Pro, but the choice depends on whether you optimize for peak coding score, price, or verbosity. DeepSeek V4-Pro is far cheaper per token; MiniMax M3 is less verbose; the closed frontier still wins the broad aggregate index.
| Model | License | Context | SWE-bench Pro | Output / 1M | Verbosity (tok/task) |
|---|---|---|---|---|---|
| GLM-5.2 | MIT | 1M | 62.1 | $4.40 | ~43K |
| DeepSeek V4-Pro | MIT | 1M | 76.2 | $0.87 | n/a |
| MiniMax M3 | open | 512K | not listed | $1.20 | ~24K |
| GPT-5.5 | closed | large | 58.6 | $30.00 | ~16K |
| Claude Opus 4.8 | closed | large | not listed | $25.00 | n/a |
The DeepSeek V4-Pro SWE-bench Pro figure (76.2) comes from a different tracker (the yage.ai audit) than Z.ai's self-reported GLM-5.2 number, so read cross-model SWE-bench Pro comparisons with care; harness and verifier differences move these by several points. See DeepSeek V4 for that model's full breakdown.
GLM-5.2: Pros and Cons
- Top open-weights coding model: 62.1 SWE-bench Pro, beats GPT-5.5
- MIT license, no regional restrictions, weights on Hugging Face
- 1M-token context with IndexShare (2.9x FLOP cut at 1M)
- ~1/6th the per-token cost of GPT-5.5 / Opus 4.8
- Drops into Claude Code, Cline, OpenCode with a config change
- Beat Claude Code on Semgrep's IDOR cyber benchmark
- Very verbose: ~43K output tokens/task (37K reasoning) vs 16K for GPT-5.5, so effective cost-per-task is closer to frontier
- reasoning_effort defaults to max, not high, which surprises people and runs up token bills
- Tool calling needs the glm47 parser; the glm45 parser silently fails
- More reward-hacking behavior than GLM-5.1 (Z.ai added an anti-hack module)
- No vision/multimodal support
- Self-hosting is heavy: ~1.5TB BF16, 8x H200/B200 for a single node; long-context throughput degrades on consumer hardware
- Trails the closed frontier by a few points on the aggregate Intelligence Index (51 vs 55-56)
When to Use GLM-5.2 (and When Not)
- You want a top open-weights coding model with an MIT license you can self-host or fine-tune.
- Cost per token matters and you can cap reasoning effort at High.
- You need agentic/terminal coding: it leads open-weights on SWE-bench Pro and Terminal-Bench.
- You want to drop a cheaper backing model into Claude Code, Cline, or OpenCode.
- You need vision/multimodal input; GLM-5.2 is text-only.
- Latency and token budget dominate; the verbosity at Max is a real tax.
- You want the absolute top coding score regardless of cost (closed frontier still leads the aggregate).
- You need the cheapest per-token open model; DeepSeek V4 undercuts it 5x on output.
Frequently Asked Questions
What is GLM-5.2?
An open-weight (MIT) mixture-of-experts coding model from Zhipu AI (Z.ai), released June 13, 2026. 753B total parameters (~40B active), 1M-token context, 128K max output. It leads open-weights coding benchmarks: 62.1 SWE-bench Pro, 81.0 Terminal-Bench 2.1. Weights on Hugging Face (zai-org/GLM-5.2).
Is GLM-5.2 better than GPT-5.5 or Claude Opus 4.8?
On SWE-bench Pro, GLM-5.2 (62.1) beats GPT-5.5 (58.6). On Terminal-Bench 2.1 it trails Opus 4.8 (81.0 vs 85.0). On the broad Intelligence Index v4.1 it scores 51, the open-weights leader, behind GPT-5.5 (55) and Opus 4.8 (56). It wins on price and open weights; the frontier still edges it on the aggregate.
How much does GLM-5.2 cost?
Z.ai list pricing: ~$1.40/M input, $0.26/M cached, $4.40/M output, roughly one-sixth the per-token cost of GPT-5.5 or Opus 4.8. But it is verbose (~43K output tokens/task), so effective cost-per-task is near $0.46. Morph serves morph-glm52-744b at $1.10/M input and $4.10/M output.
What is GLM-5.2's context window?
1M tokens with 128K max output. On Z.ai the 1M mode is opt-in via the glm-5.2[1m] identifier. r/LocalLLaMA reports generation throughput degrades badly past 50K tokens on consumer hardware, so "fits in memory" and "usable at 1M" are different things.
Why does my GLM-5.2 tool calling fail?
GLM-5.2 emits the newer <tool_call> format. If your server uses the older glm45 tool-call parser, the call stays as raw text in message.content and is never parsed. On SGLang, use --tool-call-parser glm47; on vLLM, use a recent main build to run tool calling and MTP together.
Can I self-host GLM-5.2?
Yes, under MIT. At 753B total the BF16 footprint is ~1.5TB (8x H200/B200 for a single node). FP8 is ~744-890GB, 4-bit ~176-180GB. Poolside demoed a 3-bit MLX build on an M3 Max at ~26 tok/s, ~100GB peak, but long-context throughput falls off sharply.
Does GLM-5.2 have a reward-hacking problem?
The release notes disclose GLM-5.2 exhibits more reward-hacking behavior than GLM-5.1, attempting to read protected files and reach hidden tests during training. Z.ai added a two-stage anti-hack module and critic-based PPO. The behavior was suppressed, so eval-gate agentic runs where the model has filesystem or test access.
Related Articles
The fastest endpoints are private deployments
Morph's top speeds come from dedicated deployments, not shared public endpoints: speculators trained on your traffic, caching tuned to your workload, and volume discounts over public per-token rates. Over 100 billion tokens per day run this way.
Run GLM-5.2 with better code-search context
WarpGrep is an agentic code search tool that works as an MCP server. Connect it to a GLM-5.2 agent so the 1M-token window fills with the right code, not the model's own reasoning. Free for 100k requests, then $1 per 1M.
Sources
- Z.ai / Hugging Face: GLM-5.2, Built for Long-Horizon Tasks (official blog)
- Hugging Face: zai-org/GLM-5.2 model card (753B, MIT, benchmarks)
- GitHub: zai-org/GLM-5 (From Vibe Coding to Agentic Engineering)
- SGLang cookbook: GLM-5.2 serving (glm47 tool-call parser, EAGLE MTP flags)
- vLLM recipes: zai-org/GLM-5.2 (tool calling + MTP on main)
- Artificial Analysis: GLM-5.2 intelligence, price, and output-token-per-task data
- Semgrep: GLM-5.2 beats Claude in our cyber (IDOR) benchmarks
- VentureBeat: GLM-5.2 beats GPT-5.5 on long-horizon coding for 1/6th the cost
- Medium: Cheap Tokens, Expensive Habits, GLM-5.2 verbosity cost math
- Hacker News: GLM-5.2 is the new leading open-weights model (practitioner reports)
- DataCamp: GLM-5.2 features, setup, benchmarks, Claude Code / Cline config
- Latent Space AINews: GLM-5.2, IndexShare for speculative decoding