GLM-5.1
AvailableGLM-5.1 is a Z.ai flagship text model released on 2026-04-07.
Good for Coding agents · Hard reasoning
Is it right for you?
Z.ai built it for long tasks and says it can work on one task for up to 8 hours. It is two versions before our current GLM-5.3 and one before GLM-5.2. Z.ai lists a 200K context window for it, much smaller than the 1M it lists for GLM-5.2. It takes text only. Pick it only if your workflow is already tuned for it.
Best for
- Agentic coding where you already tested GLM-5.1 and want stable results.
- Front-end work, prototypes and office documents, which Z.ai lists as use cases.
- Long autonomous runs on one task.
Not ideal for
- Very large prompts: Z.ai lists 200K context, below GLM-5.2.
- Images and video: GLM-5.1 takes text only.
- New projects: GLM-5.3 is the newer flagship.
Next to the rest of the Z.ai (Zhipu) line
| Model | Input | Output | Context | Per session |
|---|---|---|---|---|
| GLM-5.1 (this page) | $0.6438 | $2.5753 | 31K | $0.2215 |
| GLM-5.2 | $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.004172
- Coding session
- $0.22
- Per day
- $8.34
- Suggested key budget
- $290.00
- Alert at 80%
- $232.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.1 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 | 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.1curl https://api.yunshurouter.com/v1/chat/completions \
-H "Authorization: Bearer $YUNSHU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.1",
"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.1",
"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.1",
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.1",
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.1?
GLM-5.1 is a text model from Z.ai (Zhipu AI), released on 2026-04-07. It is made for long agent and coding tasks.
Does GLM-5.1 support tool calling?
Yes. Tool calling works in both the OpenAI format (tools) and the Anthropic format (tools with input_schema).
Does GLM-5.1 support reasoning?
Yes. Z.ai turns thinking on by default and lets you turn it off. Z.ai does not list effort levels for this model.
Should I use GLM-5.1 or GLM-5.3?
Use GLM-5.3 for new work. It is two releases newer. GLM-5.1 has a smaller listed context window (200K) and Z.ai lists no effort levels for it. Pick GLM-5.1 only if your prompts and tests are built on it. You can also list GLM-5.3 first and GLM-5.1 as a fallback with models (OpenAI format) or fallbacks (Anthropic format).