GLM 5.1

Z.ai · Text Generation
POST /v1/chat/completionsLong-context Zhipu AI reasoning model with 202K context, 128K output, tool calling, structured output, and cache support.
See GLM 5.1 pricing and specs or try it in the Playground.
At a glance
| Field | Value |
|---|---|
| Model id | glm-5-1 |
| Model release date | 2026-04-07 |
| Input modalities | Text |
| Output modalities | Text |
| Context window | 202.7K |
| Weight precision | - |
| Max output tokens | 128,000 |
| Region | China |
| Features | reasoning, function_calling, cache |
| Native inference | No |
| New | No |
| Structured output | JSON Mode |
| Supported endpoints | POST /v1/chat/completions, POST /v1/responses, POST /v1/messages, POST /v1beta/models/glm-5-1:generateContent |
Pricing
| Charge | Spec | Rate |
|---|---|---|
| Input | per 1M prompt tokens | <=32K |
| Output | per 1M generated tokens | <=32K |
| Implicit cache read | per 1M cached input tokens | <=32K |
| Web Search (Linkup) | per call when invoked | $0.013 |
Example request
curl https://api.empiriolabs.ai/v1/chat/completions \-H "Authorization: Bearer $EMPIRIOLABS_API_KEY" \-H 'Content-Type: application/json' \-d '{"model": "glm-5-1", "messages": [{"role":"user","content":"Hello"}]}'
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
max_tokens | integer | no | - | Maximum output tokens. When omitted, the model’s own default applies. · Range: 1 – 128000 |
temperature | number | no | 1 | Sampling temperature. 0 = deterministic, 1.99 = maximum randomness. · Range: 0 – 1.99 |
top_p | number | no | 0.95 | Nucleus sampling probability mass. Lower = more focused. · Range: 0 – 1 |
top_k | integer | no | 20 | Limits sampling to the top K tokens. · Range: 1 – 100 |
repetition_penalty | number | no | 1 | Penalizes repeated tokens. · Min: 0.1 |
reasoning_effort | enum | no | "medium" | Reasoning effort level. none disables thinking. low, medium, high, and max set bounded thinking budgets sized to the selected model. · Allowed: none, low, medium, high, max |
enable_thinking | boolean | no | true | Allow the model to reason before answering. With response_format, the model answers without reasoning unless the request sets enable_thinking. |
thinking_budget | integer | no | 32768 | Maximum tokens reserved for reasoning when thinking is enabled. · Range: 1 – 38912 |
tool_stream | boolean | no | false | Stream function-call arguments incrementally when streaming. |
tools | array | no | [] | OpenAI-compatible function calling tool definitions. |
tool_choice | object | no | - | OpenAI-compatible tool choice control. |
parallel_tool_calls | boolean | no | - | Allow multiple tool calls in a single assistant turn. When omitted, the model’s own default applies. |
stop | array | no | - | Optional stop sequences. |
response_format | enum | no | - | Return the output as a valid JSON object (JSON mode). Describe the fields you want in your prompt. |
web_search_linkup | boolean | no | false | Optional web search powered by Linkup. When enabled, recent web sources are retrieved using your latest user message as the query and provided to the model as additional context. Adds $0.013 per call when invoked on top of the model’s normal token cost. Disabled by default. |
disable_formatting | boolean | no | false | Return the answer without the Sources list that web search adds. |
Machine-readable schema: GET https://api.empiriolabs.ai/v1/models/glm-5-1.
