← all posts
// models · glm

GLM-5.1: The cost and latency worksheet

And no, GLM-5.2 isn't real yet, whatever tab you have open told you. Z.AI's current flagship coding model is GLM-5.1: 200K context, up to 128K output, built for agentic coding and long-horizon work, with thinking mode, streaming tool calls, and OpenAI-compatible endpoints, tested as glm-5.1. Check the provider's docs before you wire this in; aliases and prices move.

The instinct is to open a benchmark table and let it pick your next model. Don't. Start from what you're asking the model to do, the deadline, the evidence, the tools, and what a wrong answer costs. That's what tells you whether GLM-5.1 changes anything for your pipeline, not its row on a leaderboard.

What counts as done, before you ask

Decide what counts as accepted before the first prompt, not after you're impressed by the output. For extraction that's a schema-valid record whose fields trace to the source. For coding it's a patch that clears tests and a reviewer. For research it's claims backed by citations. None of those is "reads well." A fluent wrong answer costs a reviewer the same time as a fluent right one, and GLM-5.1 writes well enough that the gap won't show unless you force it.

The full receipt, not the sticker price

Measure the whole bill, not the headline rate: uncached and cached input tokens, reasoning against visible output, tool-call charges, retries, p50 and p95 latency, and the minutes spent repairing what came back. Do this per workload; a coding task and an extraction task share nothing. Keep the full request too: system instructions, tool schemas, files, sampling or reasoning settings, output limit. A model looks better or worse depending on whether your harness hands it native tool calls or makes it parse pasted terminal output, so hold the workflow fixed or you're comparing harnesses.

Plausible is not the same as correct (glm)

The expensive mistake: comparing input-token list prices while output tokens, cache writes, tool calls, and failed attempts run up the real bill. Frontier models make this easy to miss: almost everything they hand back sounds right. Measure what code can check, have a reviewer flag concrete defects, and keep the wrong answers. Failures say more about where to route traffic than clean runs do. Long context deserves the same suspicion: a bigger window doesn't erase prefill time, quiet retrieval noise, or separate trusted instructions from a pasted document. Put a stable prefix first if the API caches it, keep volatile fields off that boundary, and send a checkpoint instead of full history. Ask for a decision and its evidence, not an essay.

The model doesn't get to hold the keys (glm)

Tool use changes the risk profile. GLM-5.1 might pick the right function better than its predecessor; your application still validates every argument, confirms the caller's allowed, caps what one call can do, catches duplicate requests, and logs what happened. A web page, a file, an email thread, or an earlier tool's output is data the model reads, not an instruction it obeys. No amount of capability substitutes for a narrow interface to anything that spends money, deletes a record, or sends a message.

Pin it, dial it, don't chase it

The rule that survives contact with reality is boring: optimize verified work per dollar and per second, not the cheapest token, and put it in configuration rather than trusting whoever's on call to remember what's fashionable. Log model identity, phase timings, token categories, tool outcomes, and eval results, and skip sensitive prompt content by default. Keep a fast, cheap lane for routine work and an escalation condition, the reasoning-effort dial I've covered, that reaches for GLM-5.1 only when it benefits. A low-cost model stops being cheap once retries and review outrun what you saved on inference. Treat every swap like a dependency bump, as I argue in why model migration is never optional: pin a dated version where stability matters, watch for deprecation notices, canary a new alias before full traffic, keep a fallback warm. Re-run the local eval set whenever the model, prompt, tool contract, or reasoning default changes.

What I give up here is speed. I'm a release behind whoever's chasing the newest alias, because I won't ship one I haven't canaried and won't trust a benchmark I didn't run myself. That's the trade, taken on purpose: a week slow and sure beats being current and guessing.

#glm#zai#coding#evaluation