Skip to content
English

GLM-5.3 API

POST Base URL: https://api.hiapi.ai /v1/chat/completions

This model uses an OpenAI-compatible Chat Completions endpoint. The same HiAPI API key can call enabled models in your account group; image, video, and audio models use /v1/tasks and a different request shape.

Model overview

Model nameglm-5.3
ProviderZhipu AI
TypeText generation · Chat Completions
Input / outputText / text
PricingLive HiAPI token rates

GLM-5.3 is Zhipu AI’s flagship model announced for ZCode. HiAPI exposes the model through an OpenAI-compatible Chat Completions endpoint for text input and text output.

Production guidance

Request contract
  • Send POST /v1/chat/completions with model=glm-5.3 and messages. The same HiAPI API key works across enabled models; media models use /v1/tasks with a different request shape.
  • This page documents the current HiAPI request contract. Responses may include reasoning_content as part of the assistant message; no selectable reasoning switch or effort mapping is exposed.

Best suited for

Text conversations

Use an OpenAI-compatible request shape for server-side text generation.

messages
Streaming applications

Set stream=true when the client needs incremental output.

stream

Request parameters

model string required

Use this exact public model ID.

example glm-5.3 enum: glm-5.3
messages array required

Conversation messages in order.

role enum required

Message role.

enum: systemuserassistanttool
content string required

Message text.

example Explain HTTP caching in three short paragraphs.
stream boolean optional

Set true for Server-Sent Events.

default false
max_tokens integer optional

Optional output budget; the request must fit the model context available in this integration.

example 1024
response_format object optional

Use type=json_object for JSON Mode.

tools array optional

OpenAI-compatible function definitions.

tool_choice string | object optional

Use required to force a function call, or auto for optional calls.

API examples

Request examples

Streaming response

Set stream=true and process SSE chunks until [DONE].

Request body
{
  "model": "glm-5.3",
  "messages": [
    {
      "role": "system",
      "content": "You are a concise technical assistant."
    },
    {
      "role": "user",
      "content": "Explain HTTP caching in three short paragraphs."
    }
  ],
  "stream": true
}
JSON mode

Set response_format.type=json_object and parse the returned message content as JSON.

Request body
{
  "model": "glm-5.3",
  "messages": [
    {
      "role": "user",
      "content": "Return JSON with a single string field named answer. The value should be yes."
    }
  ],
  "stream": false,
  "response_format": {
    "type": "json_object"
  }
}
Function tool call

Declare a function, execute the returned tool call, then continue with the assistant tool-call message and matching tool result.

Request body
{
  "model": "glm-5.3",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather in Shanghai? Use the function."
    }
  ],
  "stream": false,
  "tool_choice": "required",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get weather for a city.",
        "parameters": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string"
            }
          },
          "required": [
            "city"
          ]
        }
      }
    }
  ]
}

Response schema

Non-streaming responses follow the Chat Completions schema. Thinking mode also returns reasoning_content; usage is the billing detail source.

{
  "id": "chatcmpl_example",
  "object": "chat.completion",
  "model": "glm-5.3",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "An HTTP cache stores reusable responses.",
        "reasoning_content": "First identify the scope, then give a concise answer."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 18,
    "total_tokens": 42
  }
}
  1. Read choices[0].message.content for the final text; reasoning_content may also be present.
  2. For streaming, accumulate choices[0].delta.content and handle [DONE].
  3. Read prompt, completion, and total token counts from usage.

FAQ

Which endpoint and model ID should I use?

Use POST /v1/chat/completions with model=glm-5.3.

Can I reuse an OpenAI SDK client?

Yes. Set base_url to https://api.hiapi.ai/v1, use a HiAPI API key, and call chat.completions.create with messages.

Does it support JSON Mode and function tools?

Yes. JSON Mode uses response_format.type=json_object. Function calling uses OpenAI-compatible tools; execute the returned tool call and continue with the original assistant tool_calls plus a matching role=tool message.

Can the same API key call media models?

Yes, when enabled for the account. Media generation uses POST /v1/tasks and a different request shape.

How are tokens billed?

Check the live HiAPI pricing page and the usage object returned by each request. Do not copy upstream or third-party aggregator prices into your integration. View live pricing.

Next steps