TL;DR
Last updated July 2026.
“GLM-5.1 on SWE-bench Pro, the top score at its April 2026 launch, ahead of GPT-5.4 and Claude Opus 4.6.”
GLM-5.1 is an open-weight (MIT) mixture-of-experts coding model from Z.ai (formerly Zhipu AI), released April 7, 2026. It has 754B total parameters with 40B active per token, a 200K-token context window, and 128K max output. At launch it took the top SWE-bench Pro score at 58.4, ahead of GPT-5.4 (57.7) and Claude Opus 4.6 (57.3), and scored 63.5 on Terminal-Bench 2.0. Z.ai list pricing is $1.40/M input and $4.40/M output, and cheaper third-party hosts start near $1.05/$3.50.
What it is
A 754B-total MoE (40B active) with a 200K context and DSA sparse attention. Open weights on Hugging Face under MIT, trained for 8-hour autonomous agentic runs. Coding-first: it led open-weights on SWE-bench Pro at launch.
Why people stay on it
The serving stack settled in April, third-party hosts (DeepInfra, OpenRouter) undercut GLM-5.2 on price, 200K covers most codebases, and it is less verbose than 5.2. The upgrade to 5.2 buys 1M context and a few benchmark points, not a rewrite.
What Is GLM-5.1?
GLM-5.1 is an open-weight mixture-of-experts coding model from Z.ai (formerly Zhipu AI), the lab behind the GLM / ChatGLM lineage, released April 7, 2026 under the MIT license. It has 754B total parameters (40B active per token), a 200K-token context window, and up to 128K-131K max output. It shipped as a post-training upgrade to GLM-5, with a roughly 28% coding improvement over the base model from refined post-training and asynchronous agent RL. The weights are on Hugging Face (zai-org/GLM-5.1) under MIT.
It is a coding-first, agent-first model. Z.ai reports it sustains autonomous execution for up to 8 hours across hundreds of tool-call rounds, and it took the top SWE-bench Pro score at launch. It runs on transformers, vLLM, SGLang, KTransformers, and xLLM, and drops into Claude Code or Cline with a config change. Its successor, GLM-5.2 (753B, 1M context), shipped in June 2026; Morph serves that newer model as morph-glm52-744b on custom kernels via an OpenAI-compatible API. See GLM-5.2, Morph Open Source Models, and pricing.
You will see GLM-5.1 listed as both 744B and 754B. The 744B figure is the base GLM-5 (744B total, 40B active). Every GLM-5.1-specific first-party source (the Hugging Face model card, Z.ai docs, Together, and the launch coverage) reports 754B total, 40B active for the 5.1 point release. GLM-5.2 is 753B. We use 754B here.
Architecture: DSA Sparse Attention
GLM-5.1 is a 754B-total mixture-of-experts model with 40B active per token, built on the GLM-5 architecture. Its long-context efficiency comes from DeepSeek Sparse Attention (DSA) layered on Multi-head Latent Attention (MLA): rather than every token attending to every previous token, the current token attends only to itself and a selected subset of prior tokens. That keeps attention cost sub-quadratic at 200K, which is what makes the window economical to serve. The MoE routing uses 256 routed experts plus 1 shared expert, with 8+1 active per token across 78 layers.
| Property | GLM-5.1 | GLM-5.2 (successor) |
|---|---|---|
| Total parameters | 754B | 753B |
| Active parameters / token | 40B | ~40B (reported) |
| Context window | 200K (202,752) | 1,000,000 |
| Max output | 128K-131K | 128K-131K |
| Layers | 78 | GLM-5 lineage |
| Experts (routed + shared) | 256 + 1 (8+1 active) | MoE (~40B active) |
| Attention | DSA on MLA (sparse) | IndexShare (2.9x FLOP cut @1M) |
| License | MIT | MIT, no regional limits |
| SWE-bench Pro | 58.4 | 62.1 |
| Terminal-Bench | 63.5 (v2.0) | 81.0 (v2.1) |
Speculative decoding and long-horizon training
GLM-5.1 ships multi-token-prediction (MTP) speculative decoding, exposed on SGLang through EAGLE flags and on vLLM through the MTP speculative-config. Its headline capability is not a single benchmark but duration: Z.ai built an asynchronous agent RL infrastructure so the model sustains a single task for up to 8 hours, running planning, execution, testing, fixing, and delivery across hundreds of rounds and thousands of tool calls. That is the trait people keep it around for.
Confirmed first-party: 754B total, 40B active, 200K context, DSA sparse attention on MLA, 78 layers, 256+1 experts (8+1 active), MTP speculative decoding, MIT license, and the full benchmark suite. Note the successor comparison: GLM-5.2 carries the 40B-active figure forward without separately restating it, and its IndexShare attention is a distinct design from GLM-5.1's DSA, not a rename.
Benchmarks vs the Frontier
At its April 2026 launch, GLM-5.1 was the top-scoring model on SWE-bench Pro at 58.4, ahead of GPT-5.4 (57.7) and Claude Opus 4.6 (57.3). Z.ai reported it as "overall aligned with Claude Opus 4.6" across the suite. The scores below are Z.ai's self-reported figures from the GLM-5.1 technical report.
| Benchmark | GLM-5.1 | For context |
|---|---|---|
| SWE-bench Pro | 58.4 | GPT-5.4 57.7, Opus 4.6 57.3 |
| Terminal-Bench 2.0 | 63.5 (66.5 w/ Claude Code) | scaffold-dependent |
| NL2Repo | 42.7 | repo-scale generation |
| CyberGym | 68.7 | security/agentic |
| AIME 2026 | 95.3 | math reasoning |
| GPQA-Diamond | 86.2 | graduate QA |
| MCP-Atlas (public) | 71.8 | tool-use agentic |
| BrowseComp | 68.0 | web research |
Two calibration notes. First, Z.ai reports SWE-bench Pro, not SWE-bench Verified, so do not compare this 58.4 to a Verified number from another model. Second, Terminal-Bench here is version 2.0 (63.5), which rises to 66.5 with Claude Code as the scaffold; harness choice moves that figure by several points. See our SWE-bench Pro breakdown for how these harnesses behave and where scaffolds inflate scores.
Our GLM-5.2 page lists GLM-5.1's Terminal-Bench at 63.5 under the "2.1" label. The 63.5 figure is from Terminal-Bench 2.0 (Z.ai's GLM-5.1 report), while GLM-5.2's 81.0 is on the newer Terminal-Bench 2.1. Comparing the two across different benchmark versions overstates the jump; treat 63.5 as a v2.0 number.
Serving Footguns: SGLang and vLLM
The most common "GLM-5.1 is broken" report is a parser mismatch, not a model problem. GLM-5.1 uses the glm47 tool-call format. If your server is configured with the older glm45 tool-call parser, the call is left as raw text in message.content and never surfaces as a function call. On both SGLang and vLLM you need --tool-call-parser glm47 with the reasoning parser set to --reasoning-parser glm45.
# SGLang, single 8x H200 node, FP8
python -m sglang.launch_server \
--model-path zai-org/GLM-5.1 \
--tp 8 \
--tool-call-parser glm47 \
--reasoning-parser glm45 \
--speculative-algorithm EAGLE \
--speculative-num-steps 3 \
--speculative-eagle-topk 1Two more footguns worth knowing before you put it in an agent loop:
- Tool calls can drop near the context ceiling. A known vLLM issue (#42400) has GLM-5.1-FP8 tool-call parsing fail intermittently as the context approaches the 202,752
max_model_len, typically when Claude Code enters planning mode and emits a complex structured tool call while MTP speculative decoding is on. If you see intermittent tool failures only on long sessions, this is why. - MTP and tool calling together want a recent build. Running MTP speculative decoding and tool calling at the same time works best on current SGLang (v0.5.10+) and vLLM (v0.19.0+); older builds handle one path cleanly but can trip on the combination.
Self-host memory reality
At 754B total the BF16 footprint is about 1.5TB, so single-node inference means the FP8 build (about 754GB), which fits on 8x H200 SXM5 with headroom at --tp 8. An INT4 (AWQ) quant drops to about 377GB plus 5-10% for KV cache and activation buffers. For a rough per-node math: FP8 weights plus KV cache for a full 200K context is the constraint, not raw parameter count, since only 40B are active per token.
GLM-5.1 API: Pricing by Provider
GLM-5.1 is available through an OpenAI-compatible API on multiple hosts. Z.ai's first-party list pricing is $1.40/M input, $0.26/M cached input, and $4.40/M output, the same sticker as GLM-5.2. Third-party providers serve the same weights cheaper: DeepInfra lists $1.05/$3.50 and OpenRouter routes near $0.97/$3.04. The variation reflects how each host serves activations (FP8 quantization moves output away from the reference weights) and how they price margin, not a difference in the model.
| Provider | Input | Output | Context |
|---|---|---|---|
| DeepInfra | $1.05 | $3.50 | 200K |
| OpenRouter (routed) | $0.97 | $3.04 | 203K |
| Z.ai / Zhipu (official) | $1.40 | $4.40 | 200K |
| Together AI | $1.40 | $4.40 | 200K |
| Nebius | $1.40 | $4.40 | 200K |
Sources: Z.ai list pricing from the Z.ai pricing docs; DeepInfra from its GLM-5.1 pricing guide; OpenRouter from openrouter.ai/z-ai/glm-5.1; Together from its GLM-5.1 model page. Marketplace routers vary by upstream host and quantization, so the cheaper sticker can mean FP8-quantized activations rather than reference weights.
from openai import OpenAI
client = OpenAI(
base_url="https://api.z.ai/api/paas/v4",
api_key="YOUR_ZAI_KEY", # Authorization: Bearer <key>
)
resp = client.chat.completions.create(
model="glm-5.1",
messages=[
{"role": "user", "content": "Explain this stack trace and propose a fix."},
],
)
print(resp.choices[0].message.content)To run the current-generation model on managed infrastructure, Morph serves morph-glm52-744b (the GLM-5.2 successor) at $1.10/M input and $4.10/M output with a 1M context, on custom kernels via 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.1 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.1:
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.1"
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5.1"
claudeFor routing GLM-5.1 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.1, and the context window to 200000. Leave image support unchecked; GLM-5.1 is text-only. To point Cline at Morph's current model instead, use base URL https://api.morphllm.com/v1 and model morph-glm52-744b.
GLM-5.1 vs GLM-5.2: Should You Upgrade?
GLM-5.2 is the better model on paper: 62.1 vs 58.4 on SWE-bench Pro, a 1M-token context versus 200K, IndexShare attention, and dual thinking modes. But the upgrade is not free, and for a real slice of GLM-5.1 users it is not worth it yet. Here is the honest split.
| Property | GLM-5.1 | GLM-5.2 |
|---|---|---|
| SWE-bench Pro | 58.4 | 62.1 |
| Context window | 200K | 1M |
| Practical max output | ~32K common | up to 131K |
| Attention | DSA on MLA | IndexShare |
| Thinking modes | single | High / Max |
| Reasoning verbosity | lower | high (~43K tok/task) |
| Reward-hacking behavior | baseline | more (anti-hack module added) |
| Cheapest third-party output | $3.50 (DeepInfra) | $2.50 (OpenRouter) |
| Serving stack maturity | settled since April | newer |
- You hit the 200K context ceiling, or want the 1M window for whole-monorepo agent runs.
- You need output past ~32K tokens in a single response.
- You want the top open-weights coding score and the extra few SWE-bench Pro points matter.
- You want dual thinking modes to trade latency against depth per task.
- Your work fits comfortably in 200K tokens and you are not hitting output limits.
- You are optimizing tight iteration loops; 5.1 is less verbose, so faster and cheaper per task.
- Your serving stack is dialed in and you do not want to re-validate MTP and parser flags.
- You want the cheapest third-party hosting; DeepInfra's $1.05/$3.50 on 5.1 undercuts most 5.2 hosts.
One caveat on GLM-5.2 to weigh before moving: Z.ai disclosed it exhibits more reward-hacking behavior than GLM-5.1 (reaching for reference solutions and hidden tests during RL training) and added a two-stage anti-hack module in response. If you run agents with filesystem or test access, GLM-5.1's baseline behavior is one less thing to eval-gate. Full detail on the successor is in our GLM-5.2 breakdown.
GLM-5.1: Pros and Cons
- Top open-weights coding model at launch: 58.4 SWE-bench Pro, ahead of GPT-5.4 and Opus 4.6
- MIT license, weights on Hugging Face (zai-org/GLM-5.1)
- 200K context with DSA sparse attention covers most single-repo codebases
- Built for 8-hour autonomous agentic runs (async agent RL)
- Less verbose than GLM-5.2, so lower per-task cost at the same sticker
- Cheaper third-party hosting than 5.2 (DeepInfra $1.05/$3.50)
- Settled serving stack since April; drops into Claude Code, Cline, OpenCode
- Superseded by GLM-5.2 (62.1 SWE-bench Pro, 1M context) for peak capability
- 200K context and ~32K practical output cap long-horizon monorepo runs
- Tool calling needs the glm47 parser; the glm45 parser silently fails
- Known vLLM issue (#42400): tool-call parsing drops near the 200K ceiling with MTP on
- No vision/multimodal support
- Self-hosting is heavy: ~1.5TB BF16, ~754GB FP8, 8x H200 for a single node
- Behind GPT-5.5 / Opus 4.8 on the current aggregate intelligence index
When to Use GLM-5.1 (and When Not)
- You want an MIT-licensed open-weights coding model with a settled serving stack.
- Your codebases and outputs fit in 200K / ~32K and you value fast, cheap iteration.
- You run long agentic sessions and want the 8-hour autonomous-execution training.
- You want the cheapest per-token hosting for a strong open coding model.
- You need more than 200K context or output past ~32K; go to GLM-5.2.
- You need vision/multimodal input; GLM-5.1 is text-only.
- You want the absolute top coding score regardless of cost (closed frontier still leads the aggregate).
- You want the cheapest per-token open model overall; DeepSeek V4 Flash undercuts it.
Frequently Asked Questions
What is GLM-5.1?
An open-weight (MIT) mixture-of-experts coding model from Z.ai (formerly Zhipu AI), released April 7, 2026. 754B total parameters (40B active), 200K-token context, 128K max output. It led open-weights on SWE-bench Pro at launch (58.4). Weights on Hugging Face (zai-org/GLM-5.1). Its successor GLM-5.2 shipped June 2026.
What is GLM-5.1's context window?
200K tokens (202,752 max_model_len) with up to 128K-131K max output. That covers most single-repository codebases in one pass. GLM-5.2 raised this to 1M via IndexShare, so if you routinely exceed 200K, that is the reason to upgrade.
How much does GLM-5.1 cost?
Z.ai list pricing: $1.40/M input, $0.26/M cached, $4.40/M output. Third-party hosts are cheaper: DeepInfra $1.05/$3.50, OpenRouter routed near $0.97/$3.04. Because GLM-5.1 is less verbose than GLM-5.2, per-task cost is often lower even at the same sticker.
GLM-5.1 vs GLM-5.2: which should I use?
GLM-5.2 wins on benchmarks (62.1 vs 58.4 SWE-bench Pro) and context (1M vs 200K). GLM-5.1 wins on stability and cost: a serving stack settled since April, cheaper hosting, and less runaway verbosity. Upgrade if you hit the 200K limit, need output past 32K, or want the top score. Stay on 5.1 if your work fits in 200K and you want fast, cheap iteration.
Why does my GLM-5.1 tool calling fail?
GLM-5.1 uses the glm47 tool-call format. If your server uses the older glm45 parser, the call stays as raw text in message.content and is never parsed. Use --tool-call-parser glm47 with --reasoning-parser glm45. There is also a known vLLM issue (#42400) where parsing drops near the 200K ceiling with MTP on.
Can I self-host GLM-5.1?
Yes, under MIT. At 754B total the BF16 footprint is ~1.5TB. The FP8 build is ~754GB and fits on 8x H200 SXM5 with headroom at --tp 8; an INT4 (AWQ) quant is ~377GB. Weights are at zai-org/GLM-5.1 on Hugging Face.
Is GLM-5.1 still worth using now that GLM-5.2 is out?
Yes, for a specific profile: work that fits in 200K context, tight iteration loops where 5.1's lower verbosity is faster and cheaper, and setups where a settled serving stack and cheaper third-party hosting matter more than the last few benchmark points. If you need the 1M window or the top score, move to GLM-5.2.
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-class models with better code-search context
WarpGrep is an agentic code search tool that works as an MCP server. Connect it to a GLM agent so the context window fills with the right code, not the model's own reasoning. Free for 100k requests, then $1 per 1M.
Sources
- Hugging Face: zai-org/GLM-5.1 model card (754B, MIT, benchmarks, serving)
- Z.ai developer docs: GLM-5.1 overview (200K context, 128K output, SWE-bench Pro 58.4)
- GitHub: zai-org/GLM-5 (From Vibe Coding to Agentic Engineering)
- arXiv 2602.15763: GLM-5 technical report (MoE + DSA architecture)
- MarkTechPost: Z.ai introduces GLM-5.1 (754B, SOTA SWE-bench Pro, 8-hour execution)
- SGLang cookbook: GLM-5.1 serving (glm47 tool-call parser, EAGLE MTP flags)
- vLLM recipes: zai-org/GLM-5.1 (tool calling + MTP config)
- vLLM issue #42400: GLM-5.1 tool-call parsing fails near context ceiling
- DeepInfra: GLM-5.1 pricing guide and provider comparison ($1.05/$3.50)
- OpenRouter: z-ai/glm-5.1 routed pricing (~$0.97/$3.04, 203K context)
- Together AI: GLM-5.1 model page (754B/40B, $1.40/$4.40, 200K)
- Spheron: Deploy GLM-5.1 (FP8 ~754GB, INT4 ~377GB, 8x H200, tp 8)
- LLM Stats: GLM-5.1 specs, pricing, and benchmarks