GLM-5.4

glm-5.4
TextZ.aiGLM-5.4glm-5.4

glm-5.4 is the newest GLM-5 flagship; unlike GLM-5.3 it loops 28 layers twice with shared weights, trading compute depth for reasoning and fewer output tokens on hard problems. Built for complex coding, with a 1M-token context, 128K output, tool calls and response format controls.

Authentication

Base URL
https://api.dreamto.ai
Authorization
Authorization: Bearer YOUR_API_KEY
Content-Type
application/json
Model name (model)
glm-5.4

Integration protocol

Why choose this protocol

Best for existing OpenAI SDK, Chat Completions code, or unified gateway integrations.

Endpoint URL
POST/v1/chat/completions
Authorization: Bearer YOUR_API_KEYContent-Type: application/json

Request / response JSON

Request
{
  "model": "glm-5.4",
  "tools": [],
  "top_p": 1,
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": "Hello, world"
    }
  ],
  "max_tokens": 4096,
  "temperature": 0.7,
  "tool_choice": "auto",
  "response_format": {
    "type": "json_object"
  },
  "reasoning_effort": "medium",
  "system_instruction": "You are a rigorous assistant."
}
Response
{
  "id": "chatcmpl_example",
  "model": "glm-5.4",
  "usage": {
    "total_tokens": 24,
    "prompt_tokens": 8,
    "completion_tokens": 16
  },
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello, world"
      },
      "finish_reason": "stop"
    }
  ],
  "created": 1710000000
}

Request / response fields

Request fields
FieldField typeRequiredDefaultOptions / rangeDescriptionExample
messagesarrayY--OpenAI-compatible chat message array.[{"role":"user","content":"Hello, world"}]
system_instructionstringN--Used to set the role, style, and boundaries of responses.You are a rigorous assistant.
temperaturenumberN0.7-Controls randomness; lower is more stable.0.7
top_pnumberN1-Nucleus sampling probability threshold.1
max_tokensintegerN--Limits the maximum output length of this response.4096
streambooleanNfalse-Whether to use a streaming response.false
reasoning_effortenumNmediumlow, medium, highreasoning_effort used by reasoning models.medium
response_formatobjectN--Structured output format, e.g. JSON object.{"type":"json_object"}
toolsarrayN--OpenAI tools/function calling definitions.[]
tool_choicestringN--auto, none, or a specific tool.auto
Response fields
FieldField typeRequiredDefaultOptions / rangeDescriptionExample
idstringN--Response identifier for this request.chatcmpl_example
modelstringN--Name of the model that actually responded.glm-5.4
choices[].message.contentstringN--The main text content generated by the model.Hello, world
usage.prompt_tokensintegerN--Number of tokens consumed by the request input.8
usage.completion_tokensintegerN--Number of tokens consumed by the model's output.16
usage.total_tokensintegerN--Total tokens for input and output combined.24
objectstringN---chat.completion
createdintegerN---1710000000
choicesarrayN---[{"index":0,"message":{"role":"assistant","content":"Hello, world"},"finish_reason":"stop"}]
choices[]objectN---{"index":0,"message":{"role":"assistant","content":"Hello, world"},"finish_reason":"stop"}
choices[].indexintegerN---0
choices[].messageobjectN---{"role":"assistant","content":"Hello, world"}
choices[].message.rolestringN---assistant
choices[].finish_reasonstringN---stop
usageobjectN---{"total_tokens":24,"prompt_tokens":8,"completion_tokens":16}

Code examples

cURLrequest.sh
curl -X POST "https://api.dreamto.ai/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "glm-5.4",
  "messages": [
    {
      "content": "Hello, world",
      "role": "user"
    }
  ],
  "system_instruction": "You are a rigorous assistant.",
  "temperature": 0.7,
  "top_p": 1,
  "max_tokens": 4096,
  "stream": false,
  "reasoning_effort": "medium",
  "response_format": {
    "type": "json_object"
  },
  "tools": [],
  "tool_choice": "auto"
}'