Cover: the label Model library and the title GLM-5.2: specs, benchmarks, and how to run it on Lyceum, beside a long purple-topped bar and one small outlined box.

In a coding agent, most of every prompt repeats the turn before, so the cached price shapes your bill more than the list price. That raises the questions teams bring to this page. What does GLM-5.2 cost when an agent calls it turn after turn, how does it behave, and should you use it or GLM-5.3?

What GLM-5.2 is and what it costs on Lyceum

GLM-5.2 is a 744B-parameter open model from Z.ai, released on 16 June 2026 under the MIT licence. It uses a mixture of experts (MoE) design: each token runs through only part of the network, 40B of the 744B parameters. So each token needs far less computing than the full size suggests. Z.ai built it for long, multi-step coding work. Its GLM-5 technical report is titled "GLM-5: from Vibe Coding to Agentic Engineering".

Its context window (the amount of text one request can hold) is 1 million tokens. Z.ai says the model stays stable across that full length on long tasks. The model reads and writes text only.

We bill GLM-5.2 per token, with no base fee. These are the prices on our GLM-5.2 model page, read on 23 October 2026:

Token typePrice per 1M tokens
Input$1.50
Cached input$0.38
Output$4.50

Cached input is the start of a prompt that exactly matches the start of a recent request. Prompt caching (billing that repeated text at the lower rate) is automatic on our API.

How to call GLM-5.2 with the OpenAI SDK

Lyceum is a sovereign European AI inference provider for open-source models, and our serverless models run in Paris and Finland. You reach GLM-5.2 through our serverless inference API, which speaks the OpenAI format. Point the OpenAI SDK at our base URL and set the model ID.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["LYCEUM_API_KEY"],
    base_url="https://api.lyceum.technology/openai/v1",
)

response = client.chat.completions.create(
    model="z-ai/glm-5.2",
    messages=[{"role": "user", "content": "Review this function for race conditions."}],
    max_tokens=8000,
    stream=True,
)

for chunk in response:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Streaming sends the answer in pieces as the model writes it, so long answers do not trip a client timeout. Chat completions, streaming, tool calling and usage accounting work as they do with OpenAI.

What a GLM-5.2 coding-agent turn costs, with and without the cache

A coding agent resends its whole history on every turn: the system prompt, the tool definitions and the conversation so far. Only the last step is new. When the start of the prompt matches a recent request, that part is a cache hit and bills at $0.38. When it does not match, it is a cache miss and every token bills at $1.50.

Take one hypothetical agent turn. The prompt holds 60,000 tokens, and 55,000 of them repeat the turn before. The model writes 2,000 tokens, including its reasoning. One turn costs:

turn cost = cached tokens × $0.38/1M + new input tokens × $1.50/1M + output tokens × $4.50/1M
CaseCached inputNew inputOutputTurn cost
Cache hit55,000 tokens: $0.02095,000 tokens: $0.00752,000 tokens: $0.0090$0.0374
Cache missnone60,000 tokens: $0.09002,000 tokens: $0.0090$0.0990

A miss costs about 2.6 times as much as a hit. A 40-turn session costs $1.50 in total when every turn hits, and $3.96 in total when none does. Most of the gap is the repeated input, not the answer.

Stacked bars for one GLM-5.2 agent turn with a 60,000-token prompt and 2,000 output tokens. Nothing cached: $0.0900 fresh input plus $0.0090 output, $0.0990 in total. With 55,000 tokens cached: $0.0209 cached input, $0.0075 fresh input and $0.0090 output, $0.0374 in total. Input dominates the bill, so the cache is the main lever. Calculated example, prices read 23 October 2026.
One calculated GLM-5.2 agent turn costs $0.0374 with 55,000 cached tokens and $0.0990 without, at our prices read 23 October 2026.

The example assumes every turn hits or every turn misses. Real sessions mix both, because a cache hit is best effort and depends on recent traffic. To see what you get, read `usage.prompt_tokens_details.cached_tokens` on each response. That field is missing on a miss, so read it defensively.

The way to raise the hit rate is order. Put the system prompt and tool definitions first, and add new turns at the end. Keep changing values such as timestamps out of the early text.

Two versions of the same 60,000-token agent prompt, drawn as 12 blocks of 5,000 tokens. With a stable start, the first 11 blocks match the previous turn and are billed at the cached rate of $0.38 per 1M tokens, the last one is new at $1.50: $0.0284 of input. With a timestamp at the top, the first block differs, so no leading text matches and all 60,000 tokens bill at $1.50: $0.0900 of input. Calculated example on GLM-5.2, prices read 23 October 2026.
In our calculated example, a stable 55,000-token start makes one GLM-5.2 turn cost $0.0284 of input instead of $0.0900 (prices read 23 October 2026).

Reasoning, tool calls and request limits

GLM-5.2 reasons before it answers. That reasoning is on by default, and it counts as output tokens. If `max_tokens` is too low, the reply can stop while the model is still reasoning, before any answer appears.

You can switch reasoning off. Send `reasoning_effort: "none"` in the request, or call z-ai/glm-5.2-instant, the same model at the same price without the reasoning phase.

Tool calling works in the standard OpenAI format, including parallel calls. One caveat comes from our own checks on 17 September 2026. GLM-5.2 does not enforce `tool_choice: "required"`, and it does not enforce a request to call one specific tool by name. It can answer in plain text instead, so check `message.tool_calls` and fall back when it is empty.

Each request can generate up to 131,072 tokens and run for up to 300 seconds. Time is often the tighter limit. In our status checks over the seven days to 23 October 2026, the median output speed was 55 tokens per second. The median time to first token (TTFT), the wait before the first token arrives, was 398 ms.

At that speed, writing the 2,000 output tokens of the turn above takes about 36 seconds. Reading a 60,000-token prompt first adds more time. A request that writes for the full 300 seconds produces about 16,500 tokens, far below the 131,072 cap. Those medians come from short requests, so long prompts will run slower. Our status page shows live availability.

GLM-5.2 benchmarks from Z.ai's model card

Z.ai publishes the scores below on its GLM-5.2 model card, read on 23 October 2026. Higher is better on every row. Z.ai groups Terminal Bench, SWE-bench Pro and FrontierSWE as coding tests. It lists MCP-Atlas as an agent test and GPQA-Diamond as a reasoning test. Terminus-2 is the test framework Z.ai used for Terminal Bench.

BenchmarkGLM-5.2GLM-5.1Claude Opus 4.8GPT-5.5
Terminal Bench 2.1 (Terminus-2)81.063.58584
SWE-bench Pro62.158.469.258.6
FrontierSWE (dominance score)74.430.575.172.6
MCP-Atlas (public set)76.871.877.875.3
GPQA-Diamond91.286.293.693.6

GLM-5.2 improves on GLM-5.1 in every row, most on the long agent task FrontierSWE. It sits behind Claude Opus 4.8 on all five rows. Z.ai ran most of these tests itself, in test setups it chose, such as the OpenHands coding agent for SWE-bench Pro. An outside evaluator, Proximal, ran FrontierSWE. They do not show how the model handles your repository, so run your own tasks before you switch.

Epoch AI found that since January 2026, the best open models reach the level of the best closed models about four months later. Its yardstick is the Epoch Capabilities Index. Its analysis was published on 29 May 2026.

GLM-5.2 or GLM-5.3: which one to run

GLM-5.3 starts from the same pretrained model as GLM-5.2, tuned further. Z.ai says every gain comes from that extra tuning, and reports a 50% higher score than GLM-5.2 on Z.ai Code Bench, its in-house coding benchmark. That benchmark is Z.ai's own and not public.

On our models page, GLM-5.3 is also cheaper: $1.40 input, $0.26 cached input and $4.40 output per million tokens. The same hypothetical agent turn costs $0.0301 on GLM-5.3 when the cache hits, about 20% less than on GLM-5.2.

Stay on GLM-5.2 when your agent is already tuned and evaluated on it, and a model change would mean a new round of evaluation. Start a new project with both: send the same agent tasks to each model and compare results and usage. Our GLM-5.3 guide covers the newer model, and running GLM in Europe covers the series.

Your next step: open the GLM-5.2 model page, create an API key in the dashboard and send the request above.

Sources

  1. arXiv: GLM-5, from Vibe Coding to Agentic Engineering
  2. Z.AI GLM-5.2 model card on Hugging Face
  3. epoch.ai
  4. GLM-5 GitHub Repository