Skip to content

GLM-5.4

zai/glm-5.4 is Z.AI's flagship model for long codebases, multi-step agent workflows, and terminal work. It has a 1,000,000-token context window and a 131,072-token output ceiling per response.

Model Context Output ceiling Inputs
zai/glm-5.4 1,000,000 131,072 Text, image, video, file

Output is text only. Audio input is not advertised.

Prices are per one million tokens.

Model Input Cache read Output
zai/glm-5.4 $1.26 $0.234 $3.96

Input tokens that hit the cache are billed at the Cache read rate and the remaining input tokens at the Input rate. Short prompts may not hit the cache; a hit is expected when a long, stable system prompt or document prefix is sent again.

Terminal window
curl "$LLMTR_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer llmtr-your_key" \
-H "Content-Type: application/json" \
-d '{
"model": "zai/glm-5.4",
"messages": [
{ "role": "user", "content": "Improve this TypeScript function in three bullet points." }
],
"max_tokens": 1024
}'

Reasoning tokens are spent from the max_tokens budget. With a very small max_tokens the budget can run out before the model starts its answer, and content comes back empty with finish_reason set to length. Keep the budget generous for tasks that need thinking.

Reasoning is always on for this model and cannot be turned off. A plain zai/glm-5.4 request runs at low. For harder tasks, pick one of the three levels low, high or max with the model suffix or the reasoning_effort field:

{
"model": "zai/glm-5.4",
"reasoning_effort": "high",
"messages": [{ "role": "user", "content": "Trace this error down to its root cause." }],
"max_tokens": 2048
}

:fast, reasoning: false and thinking: { "type": "disabled" } are not accepted, and the none, minimal, medium and xhigh levels are rejected too. For the shared behavior, see Z.AI Thinking Control.

Send image_url, video_url and file_url parts in the OpenAI-compatible content array. Images take a public https:// URL or a base64 data:image/... URL; video and file parts need a public https:// URL.

{
"model": "zai/glm-5.4",
"messages": [{
"role": "user",
"content": [
{ "type": "text", "text": "List the accessibility problems in this interface." },
{ "type": "image_url", "image_url": { "url": "https://example.com/screenshot.png" } }
]
}],
"max_tokens": 1024
}

Video and file parts use the same shape:

{ "type": "video_url", "video_url": { "url": "https://example.com/demo.mp4" } }
{ "type": "file_url", "file_url": { "url": "https://example.com/contract.pdf" } }

Video and file input count as input tokens; a long video or a many-page document raises the cost of a request noticeably.

response_format supports json_object and json_schema:

{
"model": "zai/glm-5.4",
"messages": [{ "role": "user", "content": "Extract the parties: agreement between Acme Ltd and Beta GmbH." }],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "parties",
"strict": true,
"schema": {
"type": "object",
"properties": { "parties": { "type": "array", "items": { "type": "string" } } },
"required": ["parties"],
"additionalProperties": false
}
}
},
"max_tokens": 1024
}

The model supports function calling through tools and tool_choice, in both streaming and non-streaming requests. If exactly one tool must be chosen, send only that tool with tool_choice: "required". For tool schemas and result messages, see Tool Calling.

Sources for the model and price limits: the Z.AI model guide, core parameters and pricing.