Model Details
GLM-5.2 is an open-weight **thinking model**, MIT-licensed, built for agentic engineering. It reasons internally before answering, and the brand publishes results close to the closed frontier on long-horizon coding work: **62.1 on SWE-Bench Pro** and **81.0 on Terminal-Bench 2.1**, plus second place across FrontierSWE, PostTrainBench and SWE-Marathon and the highest-ranked open-source model on all three. You send `messages`, you get a chat completion.
Thinking is tunable through `reasoning_effort` across **seven** levels — `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` — a wider range than the usual three. **The default is `max`, the most expensive setting**: it gives the strongest answers and the largest bill, because thinking tokens are billed as output tokens. Drop to `low` or `medium` for routine work; `none` turns reasoning off entirely and returns zero reasoning tokens. It also accepts its own `enable_thinking: false` switch, which overrides `reasoning_effort` — unknown fields are forwarded verbatim — but prefer `reasoning_effort` alone, since the two overlap. A live call also returned the chain of thought in a `message.reasoning_content` field beside `content` — observed behaviour, not a documented guarantee.
The context window is 1M tokens and a single reply can run to 131,072 tokens; the brand describes the context as stably sustaining long-horizon work — large-scale implementation, automated research, performance optimisation and complex debugging.
## Best for - Multi-step bug hunting and refactoring where the model has to plan, edit and re-check its own work - Terminal- and tool-driven agent loops that call functions reliably over many turns - Reading a whole codebase or a long document set in one prompt instead of chunking it - Work that needs open-weight, MIT-licensed capability rather than a closed model - Trading cost against answer quality per request by moving the thinking level
## Choose another model when - Your input includes images, audio or video — this is a text-only model - A single reply has to exceed 131,072 tokens — that is the published output ceiling, and thinking tokens count against it - You want the cheapest possible tokens for bulk classification, tagging or translation — this model thinks at `max` by default and bills that thinking as output tokens
Served through the OpenAI-compatible chat completions API:
``` POST https://queue.modelrunner.run/z-ai/glm-5.2/chat/completions ```
Point any OpenAI SDK or OpenAI-compatible tool at `base_url = https://queue.modelrunner.run/z-ai/glm-5.2` with your ModelRunner API key; streaming, tool calling and JSON mode all work.
```js import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.MODELRUNNER_API_KEY, baseURL: "https://queue.modelrunner.run/z-ai/glm-5.2", });
const result = await client.chat.completions.create({ model: "z-ai/glm-5.2", messages: [ { role: "user", content: "Find every bug in this function, explain each one, then rewrite it with a complexity analysis." }, ], reasoning_effort: "high", max_tokens: 4096, }); ```
Billing is per token from the model's own reported usage, thinking included; repeated prompt prefixes are cached automatically and bill at a reduced rate.
