GLM 5.2
Z.ai
- Coding
- Reasoning
- Tool Use
- Function Calling
- Visible Reasoning
- Text
- MoE
- Open Weights
- Commercial
- Cost Efficient
- Ultra (200K+)
- Output 128K
- API
- Cloud
- Local
- ~753B Total / ~40B Active
- 1M Context
- MIT License
An MIT-licensed, open-weight Mixture-of-Experts model built for long-horizon agentic engineering — near-frontier coding and multi-hour autonomous tool use at a fraction of closed-model cost, shadowed by brittle tool-call parsing and heavy self-hosting requirements.
GLM 5.2 is Z.ai’s (formerly Zhipu AI) flagship open-weight model, released under an MIT license on June 16, 2026 after a June 13 soft rollout to GLM Coding Plan subscribers. It is a sparse Mixture-of-Experts architecture — roughly 753B total parameters with about 40B active per token — engineered for long-horizon agentic engineering: a truly usable 1M-token context, DeepSeek Sparse Attention with cross-layer IndexShare, and developer-controlled reasoning depth. Its headline claim is that an open-weight model can now match or narrowly trail closed frontier systems on hours-long autonomous coding work while costing a fifth to a sixth as much. That triumph is real, and it is shadowed by an equally real contradiction: elite raw capability packaged in tool-call output that serving stacks parse unreliably, plus latency tails and VRAM demands that make it a workhorse for asynchronous, self-hosted loops rather than synchronous, user-facing pipelines.
Why It Matters
The First Open-Weight Reckoning
GLM 5.2 is the first open-weight model that forces a genuine reckoning for closed-source AI laboratories. Released by Z.ai (formerly Zhipu AI) on June 16, 2026, following a soft rollout to Coding Plan subscribers on June 13 (Z.ai blog), it bridges the gap between downloadable weights and proprietary frontier intelligence in the domain of long-horizon agentic engineering. Prior open-source models excelled at isolated script generation but collapsed under the weight of multi-step tool execution, sustained reasoning, or project-scale codebase navigation. GLM 5.2 disrupts this limitation by matching or narrowly trailing proprietary leaders on benchmarks that simulate hours of autonomous, unstructured engineering work. On SWE-bench Pro, it scores 62.1 percent, decisively outperforming GPT-5.5's 58.6 percent—the first time an open-weight model has convincingly surpassed proprietary frontier models on this metric (DataCamp).
The implications of this capability extend deeply into enterprise economics and cyber-sovereignty. Operating under an MIT license, the model empowers organizations to download its massive parameters and self-host the intelligence within strictly air-gapped, on-premises environments. The profound utility of local deployment was vividly demonstrated during a recent cybersecurity incident at Hugging Face. When the platform detected an autonomous agentic attack breaching its internal datasets, security engineers attempted to use commercial frontier models to analyze the exploit payloads. The commercial models uniformly blocked the requests, as their rigid safety guardrails could not distinguish between a malicious actor building exploits and a defending engineer analyzing them. Forced to pivot, Hugging Face deployed GLM 5.2 within its protected firewall. The open-weight model successfully processed the hostile logs without triggering refusal mechanisms (SiliconANGLE). As Hugging Face's merve (@mervenoyann) noted on X, 'our infra team uncovered this and used GLM-5.2 to fix because OpenAI's model would refuse to do it' (X post).
However, the model's ascent is shadowed by a critical operational contradiction. While GLM 5.2 delivers near-frontier capability at a fraction of the cost, its real-world reliability is hampered by fragile tool-call parsing and a tendency to hallucinate tool execution. It is a structural triumph for enterprise self-hosting and high-volume agentic loops, yet a distinct liability for synchronous, user-facing pipelines where a single malformed JSON argument or fabricated web search can collapse an entire workflow.
View originalour infra team uncovered this and used GLM-5.2 to fix because OpenAI’s model would refuse to do it
The Economics
Token Pricing, Third-Party Floors, and the Coding Plan
The economic framework surrounding GLM 5.2 is highly bifurcated, forcing consumers to navigate between raw vendor API token pricing, a highly competitive secondary market of third-party inference providers, and proprietary IDE subscription models. On a baseline per-token evaluation, GLM 5.2 systematically undercuts the inference costs of leading closed-source frontier models, operating at roughly one-fifth to one-sixth the price point established by dominant US AI laboratories.
Through Z.ai's official developer platform, the standard base cost is $1.40 per one million input tokens and $4.40 per one million output tokens. To incentivize high-volume, long-context workflows, the vendor implements an aggressive caching discount, dropping the cost of repeated input tokens to $0.26 per million (docs.z.ai). However, the proliferation of third-party inference providers accessible via aggregators like OpenRouter has created a secondary market that drives the effective price floor significantly lower. Providers like DeepInfra and NovitaAI offer base rates that effectively tie for the market floor at approximately $0.95 for input and $3.00 for output (OpenRouter). When calculating the effective cost after prompt caching—which providers report averages an 85 to 94 percent hit rate for repetitive agentic loops—the true operational cost drops precipitously. OpenRouter analytics indicate that the weighted average input price actually paid by customers across the network can fall to $0.268 per million tokens.
For developers integrating the model deeply into daily workflows, paying per token rapidly becomes mathematically inviable. A single complex codebase refactoring prompt can effortlessly consume fifty thousand tokens. Multiplied across a standard workday, API inference costs can spiral to hundreds of dollars per week. To capture this segment, Z.ai introduced the "GLM Coding Plan," a flat-fee subscription ecosystem specifically designed to function within supported coding environments like Claude Code, Cursor, and Cline (Digital Applied).
This subscription structure shifts the economic burden away from token counting and toward fixed quota management:
| Tier | Monthly Cost | Annual (per-month equiv.) | Quotas | | --- | --- | --- | --- | | Lite | $18 | $12.60 | ~400 prompts/wk, 100 search calls | | Pro | $72 | $50.40 | ~2,000 prompts/wk, 1,000 search calls | | Max | $160 | $112 | ~8,000 prompts/wk, 4,000 search calls |
Subscription provenanceAt the Max tier, the $160 monthly price point actively undercuts premium proprietary subscriptions like ChatGPT Pro, which retails at $200 per month. By offering virtually unlimited context processing at a fixed, predictable rate, the GLM Coding Plan fundamentally alters the return on investment for developers requiring continuous, high-volume autonomous operations. As X user Itamar Golan (@ItakGol) framed it, proper self-hosted inference may require capital expenditures around $400K for an 8x H200 cluster, 'But compare that to enterprises paying millions a month to closed labs. Suddenly, open models are not a hobbyist narrative. They are a CFO conversation' (X post).
This pricing landscape serves two distinct audiences. The per-token API and cheap third-party routers are for the asynchronous builder—the developer orchestrating massive, multi-hour agentic loops where cost-per-token and cache hit rates dictate unit economics. The flat-fee Coding Plan is for the daily driver, the human in the loop who needs to throw 8,000 prompts a week at a codebase without monitoring a meter. Neither tier, however, waives the hidden tax of the model's reliability friction: the cost of a dropped connection or a hallucinated tool call mid-refactor is paid in lost time, not tokens.
| Provider | Cost | Savings |
|---|---|---|
Gemini 3 FlashGoogle AI Studio | -66% less | |
Qwen 3 MaxAlibaba Cloud | -35% less | |
GLM 5.2Z.ai | ||
Gemini 3 ProGoogle AI Studio | +59% more |
Sources of truth
- Z.ai official pricing(Z.ai)
- OpenRouter (third-party providers, ~$0.95/$3.00)(OpenRouter)
View originalProper inference may require something like 8 Nvidia H200s, around $400K to buy or $20K/month to rent. But compare that to enterprises paying millions a month to closed labs. Suddenly, open models are not a hobbyist narrative. They are a CFO conversation.
Architecture & Context
Sparse Attention, IndexShare, and a Usable Million Tokens
- Total Params
- ~753B
- Active Params
- ~40B
- Context
- 1M
- Max Output
- 128K
The defining operational characteristic of GLM 5.2 is its advertised 1,048,576-token context window, allowing it to ingest and process project-scale engineering contexts without inherent truncation. To access this full capacity via the native API, developers must append a specific bracketed identifier to the model name, formatting the request as glm-5.2[1m]. The maximum output generation ceiling is simultaneously capped at 128,000 tokens (docs.z.ai). Achieving this scale requires circumventing the quadratic memory and computational bottlenecks of standard transformer architectures, relying on a triad of specific structural innovations.
The foundational mechanism is the implementation of DeepSeek Sparse Attention. Standard transformer attention scales quadratically; as the context window doubles, the computational requirement quadruples. This dynamic renders million-token contexts mathematically prohibitive for dense architectures. DeepSeek Sparse Attention circumvents this wall by utilizing a content-dependent indexer to compute attention only over a highly sparse subset of the top tokens per attention head, preserving long-range dependencies without calculating every interaction (Z.ai blog).
To further optimize this sparsity, Z.ai integrated a novel architectural mechanism termed IndexShare. In traditional sparse implementations, the model must compute the top-k token indices at every single layer, incurring significant operational overhead. IndexShare optimizes this by grouping the transformer into blocks of four consecutive layers. The computationally expensive indexer is executed only at the first layer of the group, and the resulting attention indices are cached and reused by the subsequent three layers. This cross-layer index reuse slashes the per-token computational floating-point operations by a factor of 2.9 at a one-million-token context length, massively accelerating throughput while simultaneously reducing memory bandwidth pressure (Z.ai blog, Hugging Face model card).
The architecture breaks the autoregressive bottleneck through an advanced Multi-Token Prediction (MTP) layer. By sharing parameters across three distinct prediction layers, the model can predict multiple future tokens simultaneously. Combined with a speculative decoding process featuring a five-token draft window, the model achieves a twenty percent increase in token acceptance length, producing output significantly faster without requiring a separate, memory-intensive draft model (Hugging Face model card).
Independent evaluations provide substantial evidence of the model's usable recall at extended lengths. A technical report by Braintrust subjected the model to an exact Abstract Syntax Tree retrieval benchmark, designed to test whether the model's sparse attention mechanism would compromise source-local fidelity under heavy context pressure. Moving the evaluation from a 25,000-token prompt up to a 50,000-token prompt, GLM 5.2's retrieval accuracy did not degrade; in fact, the score remained statistically flat, shifting slightly from 83.3 percent to 84.5 percent. This flat trajectory indicates zero external retrieval degradation within that range, proving the model can reliably extract specific algorithmic functions buried deep within thousands of lines of surrounding code (Braintrust).
The 1M boundaryUnderlying these capabilities is a persistent, unresolved contradiction regarding the model's exact scale. The parameter count varies across primary and secondary sources, likely stemming from differing methodologies for calculating the underlying Mixture-of-Experts (MoE) routing layers:
| Source | Total Parameters | Active Parameters | | --- | --- | --- | | Z.ai technical docs | 744B | 40B | | Z.ai promotional domain | 745B | 44B | | Hugging Face / ModelScope / NVIDIA API | 753B | 40B |
Regardless of the exact numerical boundary, the architecture employs 256 experts, activating eight per token, which yields a highly efficient sparsity rate of 5.9 percent (Hugging Face). The model is text-only, lacking any native or bolted-on capabilities for vision understanding, image generation, audio transcription, or video synthesis. Developers requiring visual inputs must route workloads to separate first-party models like GLM-5V-Turbo or GLM-4.6V, creating friction for multimodal agentic workflows (docs.z.ai).
Coding & Agentic Capabilities
Project-Level Takeovers and Multi-Hour Autonomy
GLM 5.2 fundamentally redefines the coding capabilities expected from an open-source architecture, establishing itself as the premier model for complex software development tasks. Its capabilities extend far beyond generating isolated algorithmic functions, demonstrating a profound consistency in managing multi-file context, analyzing cross-module dependencies, and executing iterative refactoring workflows.
On standard, contamination-resistant evaluations, the model's performance is highly disruptive. It achieved an 81.0 on Terminal-Bench 2.1, a benchmark measuring autonomous terminal-based coding where the agent writes, executes, and debugs code within a live shell environment. This score represents a massive 17.5-point increase over its predecessor, GLM 5.1, and places it within striking distance of Claude Opus 4.8's score of 85.0 (DataCamp). On SWE-bench Pro, an evaluation assessing a model's ability to resolve real-world GitHub issues across professional repositories, GLM 5.2 scored 62.1 percent. This result decisively outperforms GPT-5.5, which scored 58.6 percent, marking the first time an open-weight model has convincingly surpassed proprietary frontier models on this notoriously difficult metric (DataCamp).
| Coding Benchmark | GLM 5.2 Score | Comparison Model | Comparison Score | Source | | --- | --- | --- | --- | --- | | Terminal-Bench 2.1 | 81.0% | Claude Opus 4.8 | 85.0% | DataCamp | | SWE-bench Pro | 62.1% | GPT-5.5 | 58.6% | DataCamp | | FrontierSWE | 74.4% | Claude Opus 4.8 | 75.1% | Z.ai | | PostTrainBench | 34.3% | GPT-5.5 | 25.0% | Z.ai |
Benchmark caveatThe model's consistency is particularly evident in its ability to conduct "Project-Level Codebase Takeovers." Developers report that GLM 5.2 can ingest an entire multi-file repository, generate an accurate system architecture map, and retain those complex module boundaries and engineering constraints throughout subsequent, long-running refactoring tasks. On X, Alper Tunga (@altudev) reported that the model 'completed a full end-to-end field removal in one shot. DB schemas, validation schemas, services, routes, frontend pages, components, unit tests, integration tests, and e2e tests... all of it. At once' (X post). This capacity for sustained, multi-hour execution is mirrored in agentic evaluations. On FrontierSWE, which tests an agent's ability to complete open-ended technical projects spanning hours or tens of hours, GLM 5.2 scored 74.4 percent, trailing the proprietary leader, Claude Opus 4.8, by a fractional 0.7 percentage points (Z.ai blog). Cedric (@cedric_chee) documented a 10+ hour long-horizon run, noting that 'its long-horizon execution is close to GPT-5.5 medium. The biggest difference is its agent behavior: GLM-5.2 is much more conservative, so it tends to take a longer path to the objective' (X post).
Yet, for all its engineering prowess, the model's behavioral personality is shaped heavily by its training as an autonomous software engineer, prioritizing execution over conversational pleasantries. Developers consistently note that the model exhibits a highly direct, utilitarian tone. It does not "talk too much" or "go in circles trying to explain itself," defaulting to raw output and action rather than offering the verbose apologies or moralizing preambles common in commercial models. As Hacker News user pimeys validated, 'Nothing felt off with GLM. It did what I wanted, was fast, had a decent not very annoying personality and was much cheaper than Opus or GPT' (Hacker News).
However, this utilitarian focus masks a distinct lack of creative initiative. As X user Teortaxes (@teortaxesTex) critically observed, 'One strange impression I got about GLM 5.2 is that it feels… uninspired. It's a "sir yes sir" model, a good one, it'll extrapolate the intent of your query and honestly try to do what you ask for. But it's unlikely to show initiative and explore new directions. Safe, but boring' (X post). It is a workhorse, not an architect. This conservative posture means it will take the longer, guaranteed path to an objective rather than risking a novel shortcut, a trait that yields high reliability in autonomous loops but limits its utility as a brainstorming partner.
The Semgrep IDOR vulnerability testAn independent security evaluation validated genuine multi-hop reasoning capabilities...
The mechanical foundation of this autonomy is the model's elite proficiency in structured tool use. This function-calling accuracy was subjected to intense real-world validation by the cybersecurity research firm Semgrep. Tasked with autonomously detecting complex Insecure Direct Object Reference (IDOR) vulnerabilities across a massive dataset of real-world web applications, GLM 5.2 was deployed using a minimal, bare-bones Pydantic AI harness without any custom endpoint-discovery scaffolding. Despite this lack of structural support, the model scored a 39 percent F1 metric. This score dismantled the performance of the next closest open-weight model, MiniMax M3, which scored 23 percent, and simultaneously outperformed the proprietary frontier coding agent running Claude Opus 4.6, which scored 32 percent. Semgrep's subsequent grounding audit confirmed the model achieved perfect scores in counterfactual and selectivity testing, proving that GLM 5.2 was executing genuine, multi-hop logical reasoning rather than relying on shallow pattern matching (Semgrep).
View originalIt just completed a full end-to-end field removal in one shot. DB schemas, validation schemas, services, routes, frontend pages, components, unit tests, integration tests, and e2e tests... all of it. At once. Wild.
Tool-Call Reliability
Where Reasoning Meets Execution — and Sometimes Breaks
The model's elite benchmark performance in tool use masks a critical operational vulnerability: a pervasive gap between advertised function-calling capabilities and the reliability of those calls when parsed by real-world serving stacks. Z.ai's own documentation lists Function Calling and Structured Output as first-class capabilities, natively supporting standard Anthropic tools and tool_choice parameter schemas intended to enable "multi-step filesystem operations, shell execution, and custom tools out of the box" (DataCamp, docs.z.ai). However, a recurring pattern of concrete parsing failures across multiple independent integrations reveals a system that is brittle at the exact seam where reasoning meets execution.
The most load-bearing failure is tool-call leakage. A critical bug documented within the vLLM inference repository reveals that GLM 5.2 intermittently fails to separate its internal logic from its structured output. The model erroneously emits raw XML blocks directly inside its reasoning tags. Because the generation engine considers the assistant's turn complete at the conclusion of the logic block, the leaked tool call is never properly parsed into the correct JSON execution array, causing the entire agentic loop to instantly abort and fail (GitHub). A separate vLLM issue specifically flags that when tool_choice: required is set, the tool call fails to parse into tool_calls and instead appears as raw output content, though it reportedly functions correctly under tool_choice: auto (GitHub).
This parsing fragility is not isolated to raw inference frameworks; it actively degrades the experience inside proprietary IDE integrations. Within the Cursor IDE Agent Mode, multiple users report that tool calls such as grep, file-search, and read silently fail to execute. In separate threads, developers document the model intermittently printing raw tool-call markup as literal text rather than triggering the tool, and in the most severe cases, every tool call causes the chat session to terminate entirely after printing the raw markup (Cursor Forum, Cursor Forum). The issue extends to other harnesses; the charmbracelet/crush agent reports hard crashes on GLM-5.2 via Fireworks, where tool-call arguments are rejected as invalid JSON, killing the session (GitHub).
The economic and operational impact of this fragility is severe. In long-horizon agentic loops, a single unparseable JSON array or a prematurely terminated chat session discards extensive reasoning context, wasting thousands of tokens of compute and forcing the developer to manually restart the pipeline. This transforms the model from an autonomous engine into a liability for synchronous, user-facing applications where consistent execution is mandatory. The model possesses the raw logical capability to orchestrate complex multi-hop reasoning, as proven by its Semgrep IDOR vulnerability detection performance, but it frequently fails to package that reasoning into the rigid syntactic containers required to actually execute the tools it calls.
Known Issues & Quirks
The Friction Tax on a Frontier Workhorse
Deploying GLM 5.2 in production environments exposes developers to several documented failure modes, structural quirks, and severe operational bottlenecks. The model's raw architectural competence is heavily counterbalanced by friction at the integration and infrastructural layers.
-
Autonomous Hallucination and Sandbox Failures: When deployed in restricted environments without strict external tool bindings, GLM 5.2 exhibits a profound refusal to admit ignorance. Rather than returning an error when lacking internet access, the model frequently hallucinates possessing proprietary tools. Users report instances where the model claims to have a "Google search tool" and confidently proceeds to simulate network latency before returning entirely fabricated facts and search results, creating massive data integrity risks for automated research pipelines (Z.ai docs). This unwavering confidence in fabricated data requires developers to implement strict systemic guardrails to ensure the model distinguishes between real tool execution and simulated text generation.
-
Severe Latency Tails Under Load: While GLM 5.2 is capable of producing blisteringly fast initial responses—clocking a Time-to-First-Token (TTFT) of just 778 milliseconds on premium cloud infrastructure—it suffers from catastrophic latency degradation under shared server loads. In a controlled evaluation of 300 automated requests, evaluators observed 36 calls exceed 10 seconds of delay, with the maximum wait time spiking to 25.9 seconds. In contrast, competing proprietary models exhibited strict latency control, with virtually zero requests exceeding the 10-second threshold. This volatility renders GLM 5.2 highly problematic for synchronous, user-facing applications where consistent response times are mandatory (Artificial Analysis).
-
The "Max" Reasoning Compute Trap: The model's
reasoning_effortparameter, designed to allocate maximum compute to difficult logic problems, is immensely token-heavy. Developers report instances where the model consumed up to 45,000 tokens and spent over fifteen minutes trapped in a continuous reasoning loop before generating a single line of code. This extreme latency forces developers to manually downgrade the model to the "high" reasoning tier to balance acceptable output quality with reasonable generation speeds. Furthermore, the model has demonstrated significant unreliability when its API endpoint experiences server overload, frequently dropping connections midway through complex tasks and discarding extensive reasoning context (Hacker News). -
The Local Deployment Fiction: The "open-weights" designation is frequently criticized as a technicality due to the immense VRAM constraints. On the Reddit forum
/r/LocalLLaMA, usera-wiseman-speakethhighlighted the inaccessibility, arguing, 'Very, very, few people have the 200+ GB of VRAM needed to run the quantised versions of this locally at any usable speed. It's like saying supercars are dangerous because anyone with a driving license could legally drive one. Technically correct, but kind of deliberately obscures the reality' (Reddit). This frustration is compounded by excruciating latency for those who do attempt local deployment on constrained hardware. One user detailed running a heavily quantized 4-bit version on a workstation with 132GB of RAM, crawling at 0.15 to 0.5 tokens per second. The user reported that the model required 'about three and a half days for it to come up with the final output' (Reddit). True local deployment requires enterprise-grade clusters, such as an 8x H200 node utilizing theGLM-5.2-W4AFP8layout, pushing the model out of reach for hobbyists.
The Verdict
GLM 5.2 is a structural triumph for the open-weights ecosystem, decisively dismantling the monopoly that closed-source frontier laboratories previously held over long-horizon, autonomous engineering tasks. Featuring a resilient one-million-token context window, explicit developer controls over reasoning depth, and elite performance scores on rigorous benchmarks like SWE-bench Pro and Terminal-Bench 2.1 (DataCamp), it stands as the most capable open-source reasoning engine currently available for complex automation. It is the first time an open-weight model has convincingly surpassed proprietary frontier models on these metrics, delivering capabilities nearly identical to Claude Opus 4.8 at a fraction of the economic cost.
The model is highly recommended for enterprise security teams building automated vulnerability scanners, high-volume software development teams utilizing IDE agent subscriptions, and researchers requiring massive context ingestion for cross-document analysis. For workflows involving multi-file codebase refactoring, autonomous terminal execution, or bulk log analysis, GLM 5.2 is a triumph. The MIT license empowers organizations to self-host the intelligence within strictly air-gapped, on-premises environments, a capability that proved operationally critical for Hugging Face's security team when commercial models refused to process hostile payloads (SiliconANGLE). For asynchronous, high-volume agentic loops where cost-per-token and cache hit rates dictate unit economics, the economics are unbeatable.
Conversely, the model should be avoided by teams building latency-sensitive, synchronous conversational applications. The severe latency tails under shared server loads—where maximum wait times spike to 25.9 seconds—render it highly problematic for user-facing pipelines where consistent response times are mandatory (Artificial Analysis). Developers requiring native multimodal integration to process visual inputs must look elsewhere, as the model is strictly unimodal and requires complex routing middleware to shuttle context to separate first-party vision architectures. Furthermore, individuals hoping to operate a highly responsive local coding assistant on standard consumer hardware will find the profound VRAM requirements and sluggish quantized inference speeds entirely prohibitive. GLM 5.2 is a frontier-class workhorse, but it is a workhorse that requires careful harness engineering to prevent it from tripping over its own tool calls.
How this report was made