GLM 5.4
z-ai/glm-5.4GLM-5.4 is Z.ai's flagship model for complex software engineering, long-horizon agent work and code-driven tasks such as game building, video editing and 3D modeling. It is the first GLM built on a Loop Transformer, which runs 28 shared layers of the GLM-5 base model twice to reason more deeply without adding parameters. It always runs with reasoning enabled, accepts text, image, video and file input, and supports a 1M-token context window with up to 128K output tokens.
Specifications
- Input price
- $1.40USD / 1M tokens
- Output price
- $4.40USD / 1M tokens
- Cache read
- $0.26USD / 1M tokens
- Context window
- 1M
- Max output
- 128K
- Modalities
- Text, imageText
- Released
- Nov 23, 2026
- New
- Chat: Supported
- Vision: Supported
- Reasoning: Supported
- Structured output: Supported
- Function calling: Supported
- Audio input: Not supported
Prices in USD / 1M tokens
Quick start
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['SANDBASE_API_KEY']}"}
payload = {
"model": "z-ai/glm-5.4",
"messages": [
{
"role": "user",
"content": "Hello",
},
],
"max_tokens": 2048,
}
response = requests.post(
"https://api.sandbase.ai/v1/chat/completions",
headers=headers,
json=payload,
)
response.raise_for_status()
print(response.json())Try the model
Playground
Write a prompt to try this model. Usage is billed at the prices shown.
Try a prompt
Add an image (optional)
Your response will appear here
Choose an example or write a prompt, then click Run.
Start building
Send your first request
OpenAI-compatible endpoint with unified authentication and usage tracking.
curl -X POST "https://api.sandbase.ai/v1/chat/completions" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "z-ai/glm-5.4",
"messages": [
{
"role": "user",
"content": "Hello"
}
],
"max_tokens": 2048
}'Input Schema
9 parameters · 1 required · 8 optional
| Parameter | Type | Required | Description |
|---|---|---|---|
messages | object[] | Required | Conversation so far, as an ordered list of messages with a role (system, user or assistant) and content. |
tools | array | Optional | Functions the model may call. Each tool declares a name, description and JSON Schema parameters. |
top_k | integer | Optional | Only sample from the k most likely next tokens. · Min: 0 |
top_p | number | Optional | Nucleus sampling: only tokens within this cumulative probability are considered. · Min: 0 · Max: 1 |
stream | boolean | Optional | Stream the response as server-sent events instead of returning it in one piece. · Default: false |
max_tokens | integer | Optional | Maximum number of tokens to generate in the response. · Max: 128000 |
temperature | number | Optional | Sampling temperature. Higher values make output more random; lower values make it more focused. · Min: 0 · Max: 2 · Default: 1 |
tool_choice | string | Optional | Controls tool use: "auto", "none", "required", or a specific function. |
response_format | object | Optional | Output format, for example { "type": "json_object" } or a JSON Schema for structured output. |
Output Schema
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the completion |
object | string | Object type, e.g. "chat.completion" |
model | string | Model used for the completion |
choices | array | List of completion choices |
choices[].message.content | string | Generated text content |
choices[].finish_reason | string | Reason the generation stopped |
usage.prompt_tokens | integer | Number of tokens in the prompt |
usage.completion_tokens | integer | Number of tokens in the completion |
usage.total_tokens | integer | Total tokens used |
Questions
FAQ
How do I call Z.ai GLM 5.4 through SandBase?
Create a SandBase API key, then send requests with the model ID "z-ai/glm-5.4" to Chat Completions API (/v1/chat/completions) at https://api.sandbase.ai. The request examples on this page show the exact payload.
How much does Z.ai GLM 5.4 cost?
$1.40 per 1M input tokens and $4.40 per 1M output tokens, billed per request from your SandBase balance. Discounts, when available, are shown in the pricing on this page.
What is the context window of Z.ai GLM 5.4?
1M tokens of context, with up to 128K output tokens per response.
Which features does Z.ai GLM 5.4 support?
Z.ai GLM 5.4 supports vision (image input), reasoning, function calling, structured output. See Specifications above for the full list.
Do I need a separate Z.ai account?
No. One SandBase API key and balance gives you access to Z.ai GLM 5.4 and the other models in the catalog; you do not need to sign up with Z.ai separately.
