Skip to navigation

GLM 5.1

GLM 5.1
Z.ai · Text Generation
POST /v1/chat/completions

Long-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

FieldValue
Model idglm-5-1
Model release date2026-04-07
Input modalitiesText
Output modalitiesText
Context window202.7K
Weight precision-
Max output tokens128,000
RegionChina
Featuresreasoning, function_calling, cache
Native inferenceNo
NewNo
Structured outputJSON Mode
Supported endpointsPOST /v1/chat/completions, POST /v1/responses, POST /v1/messages, POST /v1beta/models/glm-5-1:generateContent

Pricing

ChargeSpecRate
Inputper 1M prompt tokens<=32K $1.40 $0.825; 32K-200K $1.40 $1.10
Outputper 1M generated tokens<=32K $4.40 $3.301; 32K-200K $4.40 $3.851
Implicit cache readper 1M cached input tokens<=32K $0.26 $0.165; 32K-200K $0.26 $0.22
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

ParameterTypeRequiredDefaultDescription
max_tokensintegerno-Maximum output tokens. When omitted, the model’s own default applies. · Range: 1 – 128000
temperaturenumberno1Sampling temperature. 0 = deterministic, 1.99 = maximum randomness. · Range: 0 – 1.99
top_pnumberno0.95Nucleus sampling probability mass. Lower = more focused. · Range: 0 – 1
top_kintegerno20Limits sampling to the top K tokens. · Range: 1 – 100
repetition_penaltynumberno1Penalizes repeated tokens. · Min: 0.1
reasoning_effortenumno"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_thinkingbooleannotrueAllow the model to reason before answering. With response_format, the model answers without reasoning unless the request sets enable_thinking.
thinking_budgetintegerno32768Maximum tokens reserved for reasoning when thinking is enabled. · Range: 1 – 38912
tool_streambooleannofalseStream function-call arguments incrementally when streaming.
toolsarrayno[]OpenAI-compatible function calling tool definitions.
tool_choiceobjectno-OpenAI-compatible tool choice control.
parallel_tool_callsbooleanno-Allow multiple tool calls in a single assistant turn. When omitted, the model’s own default applies.
stoparrayno-Optional stop sequences.
response_formatenumno-Return the output as a valid JSON object (JSON mode). Describe the fields you want in your prompt.
web_search_linkupbooleannofalseOptional 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_formattingbooleannofalseReturn the answer without the Sources list that web search adds.

Machine-readable schema: GET https://api.empiriolabs.ai/v1/models/glm-5-1.