POST
/
paas
/
v4
/
chat
/
completions
cURL
curl --request POST \
  --url https://api.z.ai/api/paas/v4/chat/completions \
  --header 'Accept-Language: <accept-language>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "glm-4-32b-0414-128k",
  "messages": [
    {
      "role": "user",
      "content": "What opportunities and challenges will the Chinese large model industry face in 2025?"
    }
  ]
}'
{
  "id": "<string>",
  "request_id": "<string>",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "assistant",
        "content": "<string>",
        "tool_calls": [
          {
            "function": {
              "name": "<string>",
              "arguments": {}
            },
            "id": "<string>",
            "type": "<string>"
          }
        ]
      },
      "finish_reason": "<string>"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Use the following format for authentication: Bearer <your api key>

Headers

Accept-Language
enum<string>
default:en-US,en
required

It is an HTTP request header used to inform the server of the browser's preferred list of languages, so the server can return content in the language that best matches the user's preference.

Available options:
en-US,en

Body

application/json

Response

200
application/json

Business processing successful

The response is of type object.