All posts

GLM-5.2 deep dive: the open-weight model that beats GPT-5.5 on coding

· GLM· Coding· Benchmark· Open Source

GLM-5.2 is the first open-weight model that forces an honest question: how much are you still paying for a closed frontier, and what do you actually get for it?

Z.ai, the lab formerly known as Zhipu, shipped it on June 13, 2026 — first to GLM Coding Plan users, then as a standalone API on June 16, with MIT-licensed weights following the week of June 22 on Hugging Face as zai-org/GLM-5.2. The independent numbers landed a few days later, and they did not flatter the competition.

The benchmarks, read carefully

On the Artificial Analysis Intelligence Index v4.1, GLM-5.2 scores 51. That makes it the top open-weight model in the world and fourth overall, behind only three closed flagships: Claude Fable 5 at 60, Opus 4.8 at 56, and GPT-5.5 at 55. The next open model is seven points back — MiniMax-M3 and DeepSeek V4-Pro at 44, Kimi K2.6 at 43. On an index this saturated, seven points is a tier, not a rounding error.

Coding is where the launch was aimed and where it lands hardest. GLM-5.2 scores 62.1 on SWE-bench Pro, up from GLM-5.1's 58.4 and ahead of DeepSeek V4-Pro at 55.4. That 6.7-point gap matters because SWE-bench Pro is the benchmark closest to real work: resolving multi-file GitHub issues, not toy snippets. It also posts 74.4% on FrontierSWE, took first on Design Arena, and second on Code Arena Frontend. On several long-horizon coding benchmarks it beats GPT-5.5 outright, at roughly a sixth of the cost.

Sit with one detail: a model that beats a closed flagship at code is shipping its weights under MIT. That has not happened before.

Sparse by design

GLM-5.2 is a Mixture-of-Experts model — 744 billion parameters in total, about 40 billion active on any given token. The sparsity is the whole economic story. A request runs at roughly the inference cost of a 40B dense model while drawing on the knowledge of a 744B one. That is how an open-weight model undercuts closed-frontier pricing without cutting quality to get there.

The price tag reflects it. Z.ai lists GLM-5.2 at $1.40 per million input tokens and $4.40 per million output, with cached input at $0.26 — about a fifth of the uncached rate. If you run agents that re-send a large, stable system prompt or codebase every turn, prompt caching is not a nice-to-have. It is most of your bill.

The million-token window

GLM-5.1 capped at 200K tokens. The glm-5.2[1m] variant takes that to a full million in, and up to 131,072 tokens out in one response — a five-fold jump on input, plus the headroom to actually return a large refactor instead of truncating it halfway.

The temptation is to fill the window. Don't. A million tokens of retrieved noise costs money and dilutes the model's attention. The context earns its keep on tasks that are genuinely large and coherent: a whole service dropped in for a cross-file refactor, a long spec the model has to hold as one piece, an agent loop that accumulates state across a long session. Put the files that matter in front of it, lean on cached input for the parts that don't change, and let the long output do work that used to take three stitched-together calls.

Where it sits among the open models

Open-weight Chinese models have specialized, and picking by reputation alone is now a mistake. GLM-5.2 owns long-horizon, multi-file coding — the SWE-bench Pro lead is the cleanest signal of that. DeepSeek V4-Pro is the algorithm and price-per-capability leader: it tops LiveCodeBench at 93.5% and costs less per token, so for raw, self-contained coding throughput it is very hard to beat. Kimi posts the strongest tool-use and MCP scores, which is what matters when your stack is agentic and tool-heavy.

The practical read: default to GLM-5.2 for agents that touch many files and run long, reach for DeepSeek V4-Pro when the task is contained and cost-sensitive, and Kimi when tool orchestration is the bottleneck. The good part is you don't have to pick once — one key reaches all of them.

Calling GLM-5.2 on Turiloop

It speaks the OpenAI format, so existing code changes by one field:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["TURILOOP_API_KEY"],
    base_url="https://api.turiloop.com/v1",
)

r = client.chat.completions.create(
    model="glm-5.2",
    messages=[{"role": "user", "content": "Refactor this service and add tests."}],
)
print(r.choices[0].message.content)

For long-context or agentic work, raise max_tokens to use the output headroom, keep your large stable context first so it caches, and stream so the user sees progress on a long generation:

r = client.chat.completions.create(
    model="glm-5.2",
    messages=[
        {"role": "system", "content": repo_context},  # large, stable -> cached
        {"role": "user", "content": "Add pagination to the orders endpoint and update its tests."},
    ],
    max_tokens=32000,
    stream=True,
)
for chunk in r:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="")

When GLM-5.2 is the wrong call

It is not the model for the absolute hardest agentic runs — the multi-day, high-stakes sessions where the top few percent of capability decides the outcome. That is Fable 5 territory, and the gap on the very hardest benchmarks is real. It is also overkill for high-volume, simple classification or extraction, where a smaller, cheaper model like DeepSeek V4-Flash does the same job for less. Use the ceiling when the job is at the ceiling. Use GLM-5.2 for the large middle where most real engineering actually lives.

What about GLM-5.5

Z.ai has shipped three versions in three months, so the question is fair. There is no release, no spec sheet, and no date — which means any parameter count you have seen quoted is a guess. The real signal in the cadence is simpler: the open-weight frontier now moves every few weeks. Build against an interface where the model is one string, and GLM-5.5 becomes a config change, not a migration.

FAQ

Is GLM-5.2 open source? Yes. The weights are released under the MIT license on Hugging Face (zai-org/GLM-5.2), which is genuinely permissive — commercial use included.

Is GLM-5.2 better than DeepSeek V4-Pro? For long-horizon, multi-file coding, yes: 62.1 vs 55.4 on SWE-bench Pro. For raw self-contained coding and lowest cost per token, DeepSeek V4-Pro is still excellent and cheaper. They are different tools for different jobs.

How much does GLM-5.2 cost? Z.ai's list rate is $1.40 / $4.40 per million input/output tokens, with cached input around $0.26. On Turiloop you pay as you go with an international card — no Chinese phone number or local account required.

What changed from GLM-5.1? Context grew from 200K to 1M, output to 128K, SWE-bench Pro from 58.4 to 62.1, and it claimed the #1 open-weight spot on the Artificial Analysis Intelligence Index.

GLM-5.2 is the open-weight model to beat right now, and the distance to the closed frontier has rarely been this short. You can call it today on Turiloop — alongside DeepSeek, Kimi and MiniMax — behind one OpenAI-compatible key, pay-as-you-go, international card, no Chinese phone number.