glm-5.1

glm-5.1
文本Z.aiglmglm-5.1
glm

Authentication

Base URL
https://host.docker.internal:8000
Authorization
Authorization: Bearer YOUR_API_KEY
Content-Type
application/json
Model name
glm-5.1

Integration protocols

Why this protocol

适合已有 OpenAI SDK、Chat Completions 代码或统一网关接入的用户。

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

Request / Response JSON

// REQUEST
{
  "model": "glm-5.1",
  "messages": [
    {
      "content": "你好,世界",
      "role": "user"
    }
  ],
  "system_instruction": "你是一个严谨的助手。",
  "temperature": 0.7,
  "top_p": 1,
  "max_tokens": 4096,
  "stream": false,
  "reasoning_effort": "medium",
  "response_format": {
    "type": "json_object"
  },
  "tools": [],
  "tool_choice": "auto"
}
// RESPONSE
{
  "id": "chatcmpl_example",
  "model": "gpt-5.5",
  "choices": [
    {
      "message": {
        "content": "你好,世界"
      }
    }
  ],
  "usage": {
    "prompt_tokens": 8,
    "completion_tokens": 16,
    "total_tokens": 24
  }
}

Request / Response schema

// INPUT SCHEMA
FieldTypeRequired
messagesarrayY
system_instructionstringN
temperaturenumberN
top_pnumberN
max_tokensintegerN
streambooleanN
reasoning_effortenumN
response_formatobjectN
toolsarrayN
tool_choicestringN
// RESPONSE SCHEMA
FieldTypeRequired
idstringN
modelstringN
choices[].message.contentstringN
usage.prompt_tokensintegerN
usage.completion_tokensintegerN
usage.total_tokensintegerN

Code examples

cURLrequest.sh
curl -X POST "https://host.docker.internal:8000/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
  "model": "glm-5.1",
  "messages": [
    {
      "content": "你好,世界",
      "role": "user"
    }
  ],
  "system_instruction": "你是一个严谨的助手。",
  "temperature": 0.7,
  "top_p": 1,
  "max_tokens": 4096,
  "stream": false,
  "reasoning_effort": "medium",
  "response_format": {
    "type": "json_object"
  },
  "tools": [],
  "tool_choice": "auto"
}'