GLM-5.2 ships 1M usable context for long coding agent runs

Z.ai's GLM-5.2 open-weight flagship targets million-token coding trajectories with MIT weights, High and Max reasoning modes, and Terminal-Bench scores that jump from 62.0 to 81.0 versus GLM-5.1.

SaifullahSaifullah
5 min read
GLM-5.2 ships 1M usable context for long coding agent runs

A million-token context window is easy to advertise. Keeping quality stable while an agent refactors across a repo for hours is the hard part.

GLM-5.2, from Chinese lab Z.ai (Zhipu), landed June 13–16, 2026 with a blunt claim: usable 1M context for coding-agent scenarios, not a theoretical ceiling. Weights ship under MIT license on Hugging Face and ModelScope. API access routes through Z.ai at roughly $1.40 per million input tokens, about one-sixth of GPT-5.5 pricing in their marketing.

What changed from GLM-5.1

SpecGLM-5.1GLM-5.2
Context~200K tokens1M tokens
Terminal-Bench 2.162.081.0
SWE-bench Pro58.462.1
LicenseMITMIT
Architecture744B MoE (40B active)Same backbone, IndexShare + MTP upgrades

The context jump is five times wider. The benchmark jump on Terminal-Bench is the number I keep returning to: +19 points on a harness that punishes agents who lose the thread mid-run.

GLM-5.2 adds High and Max thinking modes so you can trade latency for depth on hard tasks. Coding Plan subscribers got early access before the public weight drop.

IndexShare: making 1M context cheaper to run

Long context is not just training data. Inference cost matters when every agent turn carries thousands of tokens of repo state.

Z.ai's IndexShare reuses the same sparse-attention indexer across every four layers, cutting indexer FLOPs about 2.9× at 1M length. They also tuned the MTP speculative-decoding layer for up to 20% longer acceptance lengths.

For teams self-hosting, that is the difference between "we can technically load 1M" and "we can afford to run 1M in production loops."

GLM-5.2 long-horizon coding benchmarks compared to GLM-5.1 and frontier closed models

Long-horizon benchmarks, not just terminal puzzles

Z.ai highlighted three agent-scale evals where 1M context should matter:

BenchmarkWhat it testsGLM-5.2 positioning
FrontierSWEMulti-hour open-ended projectsWithin ~1% of Opus 4.8
PostTrainBenchAgent improves small models on one H100Beats GPT-5.5 and Opus 4.7
SWE-MarathonCompiler builds, kernel work, production servicesTop open-weight; trails Opus 4.8 by ~13%

Across those three, GLM-5.2 ranks as the highest open-source model in Z.ai's report. On standard coding benches it lands within a few points of Claude Opus 4.8 on Terminal-Bench 2.1 (81.0 vs 85.0) while staying ahead of Gemini 3.1 Pro in their table.

Simon Willison noted something easy to miss: GLM-5.2 is text-only, yet ranks second on Code Arena WebDev behind Claude Fable 5. Front-end agent workflows often assume vision for UI work. GLM-5.2 suggests strong text priors and harness integration can compensate for a lot.

How to call it from coding agents

GLM Coding Plan users enable the model by setting the name to GLM-5.2, or GLM-5.2[1m] in Claude Code for the full context window. Z.ai exposes an Anthropic-compatible endpoint, so tools like Claude Code, Cline, and OpenCode can point at GLM without a custom SDK.

Quota billing is worth watching: GLM-5.2 consumes 3× during peak hours and 2× off-peak on Coding Plan, with a promotion through September 2026 billing some off-peak usage at 1×. Peak hours are 14:00–18:00 UTC+8 daily.

Self-hosters can run through transformers, vLLM, SGLang, xLLM, and ktransformers. A 744B MoE with 40B active parameters is not a laptop model. FP8 variants exist for datacenter deployment.

vllm serve zai-org/GLM-5.2-FP8 \ --tensor-parallel-size 8 \ --max-model-len 1048576

Tune parallelism to your hardware. The point is the ecosystem treats 1M as a supported configuration, not a demo flag.

MIT weights and the sovereignty angle

MIT release matters for applied teams who need to fine-tune on private code, run behind a firewall, or ship commercial products without revenue caps. Frontier APIs stay convenient, but GLM-5.2 joins a wave of Chinese open-weight releases (Qwen, DeepSeek, Kimi) that treat permissive licenses as competitive strategy.

The trade-off is jurisdiction and ops: hosted API traffic goes to Z.ai infrastructure. Self-hosted weights remove that dependency but not the ops burden of a 744B-class model.

Where I would use it (and where I would not)

Good fits:

  • Long agent trajectories over monorepos where truncation currently forces chunking games
  • Automated research and performance optimization loops that run tens of minutes
  • Teams already on GLM Coding Plan who want one model for implementation and marathon tasks

Weak fits:

  • Quick chat or short edits where 200K models are faster and cheaper
  • Workloads needing multimodal input (use GLM-5V or another vision stack)
  • Teams without GPU budget to self-host and uncomfortable with API routing
Decision flow: when million-token GLM-5.2 beats shorter-context models for agent work

Bottom line

GLM-5.2 is not a rumor headline about context length. It is a coding-first flagship with measurable jumps on agent harnesses and an MIT weight drop. The 1M window only matters if your agents actually hold coherent state across long runs. If your bottleneck is bad search or weak verification, a wider window will not fix it.

If you are choosing models for production agent loops and want help matching context policy, inference cost, and eval harnesses to your repo shape, get in touch. Model shopping is cheaper before you bake a default into every cloud agent.

Share this post

Related posts