GLM 5.2: why I’m replacing Opus in Claude Code with this new model
- Date
TLDR
GLM 5.2, an open-weight text-to-text model from Z.AI, benchmarks within striking distance of top-tier proprietary models like Opus 4.8 and GPT 5.5 on coding tasks. In hands-on testing across codebase exploration, frontend design, and a 45-minute autonomous error-triage agent, it delivered competent, often impressive results for just $3.36 in API spend on roughly 6 million tokens. The episode makes the case that for developers willing to swap API keys and route through providers like OpenRouter, GLM 5.2 is already viable as a daily driver, with its main limitations being a text-only modality and occasional friction with React/TypeScript generation.
Key takeaways
GLM 5.2 benchmarks near frontier-tier coding models at a fraction of the API cost. On SweeBench Pro it sits roughly on par with GPT 5.5 and just below Opus 4.8, while on Frontier Suite and Post TrainBench it edges above GPT 5.5 and approaches Opus. The host explicitly frames this as a challenge to the "tax" paid to Anthropic and OpenAI, because an open-weight model you can self-host or run via cheaper inference providers is now competing on raw coding intelligence.
The model is text-only but ships with the full modern agentic interface stack. GLM 5.2 accepts only text input and output (no image modalities), yet it supports a 1M-token context window, reasoning/thinking mode, streaming, function calling, structured output, and MCP. This means it drops into existing agentic toolchains without ergonomic compromises, even though multimodal workflows are off the table.
Setup in Cursor and Claude Code requires only an OpenRouter API key and a custom base URL. The host documented a previously undocumented nuance for Cursor: users must override the OpenAI base URL with
openrouter.ai/api/v1/cursor(note the/cursorsuffix) and add the model stringz-aI/glm-5.2. For Claude Code, the same key and base URL are exported as environment variables in the shell profile, while settings JSON points to the OpenRouter model string.Live codebase exploration showed fast, accurate autonomous reasoning on a production Next.js app. When asked to audit the Chat PRD repository from scratch, GLM 5.2 correctly identified the Next.js full-stack architecture, recent shipped features (Chat v2 stability, billing, Lenny promo), security work, and dependency hygiene within a short inference time. Its accuracy on zero-shot repository orientation suggests the model effectively leverages its long context window without hallucinating directory structures.
Design and HTML generation quality was surprisingly strong, including adherence to an existing brand design system. The model generated a polished architecture overview page in HTML/CSS that matched Chat PRD's signature pink brand color and included accurate roadmaps and product pillars. When redesigning a marketing hero section, it produced tasteful hover effects, better calls-to-action, and a component-style layout that felt native to the site after one round of feedback.
A 45-minute autonomous agent task successfully triaged Sentry and Vercel errors into a shippable fix plan, despite TypeScript compilation stumbles. The host prompted GLM 5.2 to pull 72 hours of logs, prioritize bugs, and generate a fix plan; the model ran tool calls and MCPs autonomously and delivered a dark-mode HTML report with P0 issues, severity charts, and suggested sequencing. Mid-task, it struggled with React/TypeScript syntax and looped on compilation errors, but eventually recovered and produced clean code.
At $3.36 for roughly 6 million tokens, GLM 5.2 makes long-running agent workflows economically viable in a way frontier APIs do not. The host's OpenRouter bill for the entire session, including the 45-minute autonomous run and multiple design tasks, came to just over three dollars with a 72% cache rate. By comparison, running the same workload through Opus or GPT 5.5 would be orders of magnitude more expensive.
The model's text-only constraint and intermittent code-generation friction define its current boundary conditions. GLM 5.2 cannot process or generate images, ruling out multimodal design workflows. During testing, it also exhibited slower and bumpier performance when writing React/TypeScript compared to generating static HTML/CSS, requiring host intervention or extended iteration to compile.
Insights and implications
Open-weight models are crossing the threshold from "hobbyist self-hosting" to "default production stack," but their value depends on inference plumbing rather than model weights alone. The episode demonstrates that GLM 5.2's usefulness was unlocked not by downloading weights, but by OpenRouter's API interoperability and the host's existing toolchain (Cursor, Claude Code, MCPs). Because the model's intelligence approached frontier levels while the cost collapsed, the limiting factor is no longer model capability but the reliability of inference providers and cache hit rates. This implies developers should evaluate open-weight models as interchangeable commodities accessed through unified API layers, not as standalone infrastructure projects.
The "design system anchor" pattern separates slop from production-ready AI output, and it is becoming the critical meta-skill for frontend AI coding. GLM 5.2 produced generic blurple slop when unanchored, but generated brand-accurate pink palettes and component-native layouts once grounded in Chat PRD's existing site and a hypothetical design.md. This reframes AI design assistance: the model's raw taste is mediocre, but its ability to fidelity-match a provided system is high. For teams, the leverage point shifts from prompt engineering to design-system documentation and component library hygiene.
Long-running autonomy is now a cost problem disguised as a capability problem, and open-weight models flip the economics. Frontier labs charge per token, making a 45-minute iterative triage agent prohibitively expensive and forcing developers to truncate context or limit tool calls. GLM 5.2's $3.36 price for 6M tokens means the host could let the agent struggle through TypeScript compilation loops without budget anxiety. This reframes the operational constraint: the bottleneck for autonomous agents is no longer model intelligence but token budget, and open-weight inference effectively removes that cap for most startups.