GLM 5.2

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

Reasoning and coding model with a 1M token context, 128K output, adjustable reasoning effort, native web search, and tool calling.

At a glance

FieldValue
Model idglm-5-2
Model release date2026-06-16
Input modalitiesText
Output modalitiesText
Context window1M
Weight precision-
Max output tokens131,072
RegionSingapore
Featuresreasoning, function_calling, web_search
Native inferenceNo
NewYes
Structured outputJSON Mode
Supported endpointsPOST /v1/chat/completions, POST /v1/responses, POST /v1/messages, POST /v1beta/models/glm-5-2:generateContent
Alternate model idsglm-5.2, zai/glm-5.2, zhipu/glm-5.2

Pricing

ChargeSpecRate
Inputper 1M prompt tokens$1.40
Outputper 1M generated tokens$4.40
Web searchper request$0.033

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-2", "messages": [{"role":"user","content":"Hello"}]}'

Parameters

ParameterTypeRequiredDefaultDescription
max_tokensintegerno65536Maximum number of output tokens to generate. · Range: 1 – 131072
temperaturenumberno1Controls randomness. Lower values make responses more deterministic. · Range: 0 – 1
top_pnumberno0.95Nucleus sampling cutoff. · Range: 0.01 – 1
reasoning_effortenumno"max"GLM-5.2 reasoning effort. none disables thinking; minimal through max set how hard the model reasons before answering. max is recommended for complex coding. · Allowed: none, minimal, low, medium, high, xhigh, max
enable_thinkingbooleannotrueAllow the model to reason before answering. Turn off for the lowest-latency replies or strict structured output.
do_samplebooleannotrueEnable sampling. Turn off for greedy deterministic output (temperature and top_p are ignored).
tool_web_searchbooleannofalseEnable built-in web search. Adds $0.033 per request when used.
search_recency_filterenumno"noLimit"Limit web search results to a recency window. · Allowed: oneDay, oneWeek, oneMonth, oneYear, noLimit
countintegerno10Number of web search results to retrieve when web search is enabled. · Range: 1 – 50
search_domain_filterstringno-Restrict web search to a specific domain.
search_promptstringno-Optional prompt used to summarize retrieved web search results.
search_resultbooleannotrueReturn web search result metadata in the response when web search is enabled.
tool_streambooleannofalseStream function-call arguments incrementally when streaming.
toolsarrayno[]OpenAI-compatible function calling tool definitions.
tool_choiceobjectno-OpenAI-compatible tool choice control.
stoparrayno-Optional stop sequences (up to 4).
response_formatenumno-Return the output as a valid JSON object (JSON mode). Describe the fields you want in your prompt.

Variants

:variant1

FieldValue
Model idglm-5-2:variant1
Model release date2026-06-16
RegionGermany
Context window1M
Weight precision-
Max output tokens131,072
Featuresreasoning, function_calling, cache, web_search
Native inferenceNo
Structured outputJSON Schema
Supported endpointsPOST /v1/chat/completions, POST /v1/responses, POST /v1/messages, POST /v1beta/models/glm-5-2:variant1:generateContent

Pricing

ChargeSpecRate
Inputper 1M prompt tokens$1.10 (was $1.40)
Outputper 1M generated tokens$3.851 (was $4.40)
Implicit cache readper 1M cached input tokens$0.275
Web Search (Linkup)per call when invoked$0.013

Parameters

ParameterTypeRequiredDefaultDescription
temperaturenumberno0.7Sampling temperature. 0 = deterministic, 2 = maximum randomness. · Range: 0 – 2
top_pnumberno0.9Nucleus sampling probability mass. Lower = more focused. · Range: 0 – 1
max_tokensnumberno4096Maximum output tokens. · Range: 1 – 131072
stopstringno-Up to 4 strings where the model will stop generating further tokens.
enable_thinkingbooleannotrueEnable step-by-step reasoning before answering.
reasoning_effortenumno"medium"Reasoning effort level. none disables thinking. low, medium, high, and max set bounded thinking budgets sized to the selected model. Sent as an OpenAI-style reasoning_effort field, translated into enable_thinking and thinking_budget for the model service. · Allowed: none, low, medium, high, max
thinking_budgetnumberno32768Maximum tokens reserved for the reasoning process. Up to 131072. · Range: 1 – 131072
response_formatenumno-Constrain the output to JSON. Use JSON mode for any valid JSON object, or JSON schema to force output that matches a schema you provide.
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.

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