GLM-5.2
AvailableGLM-5.2 is a Z.ai flagship text model released on 2026-06-16, one version before our current GLM-5.3.
Good for Coding agents · Hard reasoning · Long context
Is it right for you?
Z.ai built it for long, multi-step agent and coding work and lists a 1M-token context window. Compared with GLM-5.3, it is the older release. Z.ai’s docs let you switch thinking on or off, while our GLM-5.3 page says that model always reasons. It takes text only. Pick it if you tested your workflow on it and do not want to move to GLM-5.3 yet.
Best for
- Coding agents on long tasks: project-wide analysis, multi-step refactors, long debugging sessions.
- Work that needs a very large prompt, if our context limit allows it.
- Teams that already tuned prompts on GLM-5.2 and want to keep the same behaviour.
Not ideal for
- Images and video: GLM-5.2 takes text only.
- New projects: GLM-5.3 is the newer flagship.
- Prompts longer than 128K tokens, the limit in our catalogue today.
Next to the rest of the Z.ai (Zhipu) line
| Model | Input | Output | Context | Per session |
|---|---|---|---|---|
| GLM-5.1 | $0.6438 | $2.5753 | 31K | $0.2215 |
| GLM-5.2 (this page) | $0.8584 | $3.0045 | 128K | $0.2962 |
| GLM-5.3 | $1.3949 | $4.8823 | 128K | $0.4813 |
| GLM-5.3 Flash | Price coming soon | Not listed | Not priced yet | |
* The maker's listed context. Ours is confirmed with our price, and may be lower. Prices and session cost show once our price is set.
What it costs
Prepaid, per token, no subscription. Set your traffic to see your bill.
30 days, at today's prices. You're billed on actual tokens.
- Per request
- $0.005623
- Coding session
- $0.30
- Per day
- $11.25
- Suggested key budget
- $390.00
- Alert at 80%
- $312.00
A coding session is 30 requests of 20,000 input tokens, 80% from cache, and 1,000 output tokens each: the same session as the "Per session" column above. Thinking tokens are billed as output, so reasoning raises the cost.
One price all day: this model has no peak pricing in our catalogue.
Capabilities
What GLM-5.2 can do, as Z.ai lists it.
| Capability | Support |
|---|---|
| Tool calling | Yes, function calling and MCP listed |
| Parallel tool calls | Not listed |
| Reasoning | Optional: on by default, can be disabled |
| Reasoning effort | Z.ai’s examples use max; other levels not listed |
| Image input | No: text in, text out |
| JSON output | Structured output listed |
| Streaming | Yes |
| Prompt caching | Context caching listed |
Get started
Create a key in the console, export it as YUNSHU_API_KEY, then use one of these.
export ANTHROPIC_BASE_URL=https://api.yunshurouter.com
export ANTHROPIC_AUTH_TOKEN=$YUNSHU_API_KEY
export ANTHROPIC_MODEL=glm-5.2curl https://api.yunshurouter.com/v1/chat/completions \
-H "Authorization: Bearer $YUNSHU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.2",
"messages": [{"role": "user", "content": "Write a Python function that reverses a string."}]
}'curl https://api.yunshurouter.com/v1/messages \
-H "x-api-key: $YUNSHU_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.2",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Write a Python function that reverses a string."}]
}'import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.yunshurouter.com/v1",
api_key=os.environ["YUNSHU_API_KEY"],
)
response = client.chat.completions.create(
model="glm-5.2",
messages=[{"role": "user", "content": "Write a Python function that reverses a string."}],
)
print(response.choices[0].message.content)import os
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.yunshurouter.com", # no /v1: the SDK adds it
api_key=os.environ["YUNSHU_API_KEY"],
)
message = client.messages.create(
model="glm-5.2",
max_tokens=1024,
messages=[{"role": "user", "content": "Write a Python function that reverses a string."}],
)
print(message.content[0].text)Full steps for each tool: integration guides →
Questions
What is GLM-5.2?
GLM-5.2 is a text model from Z.ai (Zhipu AI), released on 2026-06-16. It is made for long agent and coding tasks.
Does GLM-5.2 support tool calling?
Yes. Tool calling works in both the OpenAI format (tools) and the Anthropic format (tools with input_schema).
Does GLM-5.2 support reasoning?
Yes. Z.ai turns thinking on by default and lets you turn it off.
Should I use GLM-5.2 or GLM-5.3?
Use GLM-5.3 for new work, because it is the newer flagship. Z.ai’s docs show GLM-5.2 with a thinking on/off switch, and our GLM-5.3 page says that model always reasons, so GLM-5.2 can give shorter answers when you turn thinking off. Pick GLM-5.2 if your prompts are tuned for it. You can also list GLM-5.3 first and GLM-5.2 as a fallback with models (OpenAI format) or fallbacks (Anthropic format).