Skip to main content
z-ai avatar

GLM-5.2 Fast Preview API

z-ai/glm-5.2-fast-preview

Low-latency chat completions from the GLM-5.2 weights on throughput-tuned serving — consistently faster than the standard tier, at twice the price and identical answer quality.

reasoningtool callingjson mode
$2.8 in · $8.8 out per 1M tokens
1M context
131.1K max output

Chat with this model

Chat

Try this model — replies stream in live.
You need to be logged in to run this model and view results.
Log in

Model Pricing

Pricing

This model is billed per token, at separate rates for what you send and what it produces.

Input tokens
$2.8
per 1M tokens
Cached input tokens
$0.7
per 1M tokens
Output tokens
$8.8
per 1M tokens

Every request rounds up to the nearest $0.01.

If a run reports no token usage, it bills a flat $0.04.

GLM-5.2 Fast Preview API

GLM-5.2 Fast Preview is a text-to-text AI model by z-ai. On ModelRunner it runs through a REST API or via MCP from any AI assistant with pay-per-use pricing.

POST https://queue.modelrunner.run/z-ai/glm-5.2-fast-preview

cURL

# Submit a request to the queue. Input fields go at the top level of the
# body. The optional reserved "metadata" object holds your own flat string
# tags — stored on the request, never sent to the model; filter later with
# GET https://queue.modelrunner.run/requests?metadata=<url-encoded JSON>.
curl -X POST https://queue.modelrunner.run/z-ai/glm-5.2-fast-preview \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {
        "role": "user",
        "content": "Here is a Python function that should return the k most frequent words in a text, with ties broken alphabetically:\n\ndef top_k_words(text, k):\n    words = text.lower().split()\n    counts = {}\n    for w in words:\n        counts[w] = counts.get(w, 0) + 1\n    ranked = sorted(counts.items(), key=lambda kv: -kv[1])\n    return [w for w, _ in ranked[:k]]\n\nFind every bug, explain why each one is wrong, then give a corrected version with its time and space complexity."
      }
    ],
    "max_tokens": 8000,
    "reasoning_effort": "high",
    "metadata": {
      "project": "my-project"
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/z-ai/glm-5.2-fast-preview/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/z-ai/glm-5.2-fast-preview/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("z-ai/glm-5.2-fast-preview", {
  input: {
    "messages": [
      {
        "role": "user",
        "content": "Here is a Python function that should return the k most frequent words in a text, with ties broken alphabetically:\n\ndef top_k_words(text, k):\n    words = text.lower().split()\n    counts = {}\n    for w in words:\n        counts[w] = counts.get(w, 0) + 1\n    ranked = sorted(counts.items(), key=lambda kv: -kv[1])\n    return [w for w, _ in ranked[:k]]\n\nFind every bug, explain why each one is wrong, then give a corrected version with its time and space complexity."
      }
    ],
    "max_tokens": 8000,
    "reasoning_effort": "high"
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/z-ai/glm-5.2-fast-preview",
    headers=headers,
    json={
      "messages": [
        {
          "role": "user",
          "content": "Here is a Python function that should return the k most frequent words in a text, with ties broken alphabetically:\n\ndef top_k_words(text, k):\n    words = text.lower().split()\n    counts = {}\n    for w in words:\n        counts[w] = counts.get(w, 0) + 1\n    ranked = sorted(counts.items(), key=lambda kv: -kv[1])\n    return [w for w, _ in ranked[:k]]\n\nFind every bug, explain why each one is wrong, then give a corrected version with its time and space complexity."
        }
      ],
      "max_tokens": 8000,
      "reasoning_effort": "high"
    },
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

NameTypeRequiredDescription
messagesarrayyesOpenAI-style conversation history. Each item is an object with a `role` (`system`, `user`, `assistant` or `tool`) and `content`.
streambooleannoReturn the reply as a Server-Sent Events stream of deltas terminated by `data: [DONE]`. Default: false.
reasoning_effortenumnoHow hard the model thinks before answering, across seven levels. Defaults to `max`, the highest — lower it to cut cost, because thinking tokens bill as output tokens. `none` disables reasoning entirely. Default: "max".
max_tokensintegernoUpper bound on generated tokens, up to the family's published 131,072-token output ceiling. Thinking consumes this budget, so allow generous headroom.
toolsarraynoOpenAI-format tool definitions the model may call.
tool_choiceno`auto`, `none`, `required`, or a specific tool.
response_formatobjectnoStructured-output control. Set its `type` to `json_object` to force a JSON reply. Structured output is supported in non-thinking mode only, so pair it with `reasoning_effort` set to `none`.
stopnoUp to 4 stop sequences.
seedintegernoBest-effort determinism hint.

Machine-readable: OpenAPI schema · llms.txt

Use GLM-5.2 Fast Preview from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and GLM-5.2 Fast Preview becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint z-ai/glm-5.2-fast-preview.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run z-ai/glm-5.2-fast-preview on ModelRunner to generate text”. MCP setup guide.

Model Details

Model Details

GLM-5.2 Fast Preview runs the GLM-5.2 weights on higher-throughput infrastructure for latency-sensitive work. In back-to-back testing it ran **consistently faster than the standard tier, by roughly 20–30%** — a steady gain, not a step change, and it varies with load. You send `messages`, you get a chat completion.

**This is the more expensive tier, not the cheaper one.** It bills **twice** the standard `z-ai/glm-5.2` row per token — same weights, same answers, so you pay double for about a quarter more throughput. Worth it only when wall-clock latency is your binding constraint; otherwise use `z-ai/glm-5.2`.

Quality is GLM-5.2's own: the brand publishes **62.1 on SWE-Bench Pro** and **81.0 on Terminal-Bench 2.1** for these open-weight, MIT-licensed weights. Those are the model's published results, not a measurement of this serving tier.

Thinking is tunable through `reasoning_effort` across **seven** levels — `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` — with **`max` as the default**, the strongest and most expensive, since thinking bills as output. The context window is 1M tokens and a single reply can run to 131,072 tokens.

## Best for - Low-latency coding assistants where a developer waits on every completion - Agent loops whose wall-clock time is dominated by many sequential calls - Real-time chat products that stream tokens straight to the user - Tool-calling agents that plan, edit and re-check their own work over many turns - Reading a whole repository or document set in one prompt instead of chunking it

## Choose another model when - Cost matters more than speed — `z-ai/glm-5.2` runs the same weights for the same answers at half the token price - You need the family's most stable id — this one is a preview, with capabilities and specifications subject to change - Your input includes images, audio or video — this is a text-only model - A single reply has to exceed 131,072 tokens, which thinking also counts against

## Tips - Structured output works in non-thinking mode only — pair `response_format` with `reasoning_effort: "none"` - Budget `max_tokens` generously — at `max` effort most of it goes to thinking, and too small a budget returns an empty reply you still pay for

Served through the OpenAI-compatible chat completions API:

``` POST https://queue.modelrunner.run/z-ai/glm-5.2-fast-preview/chat/completions ```

Point any OpenAI SDK at `base_url = https://queue.modelrunner.run/z-ai/glm-5.2-fast-preview` 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-fast-preview", });

const result = await client.chat.completions.create({ model: "z-ai/glm-5.2-fast-preview", 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, }); ```