Authentication
authorization string required
All APIs require authentication via Bearer Token.
Get API Key:
Visit API Key Management Page to get your API Key.
Usage:
Add to request header:
Authorization: Bearer YOUR_API_KEY
Endpoint and compatibility
POST https://cloud.vtrix.ai/llm/chat/completions
This endpoint uses the OpenAI Chat Completions format: the top level contains choices and usage. It is not an asynchronous task API, so the response does not contain status, output, asset url, jobId, cost, or discount fields.
Parameters
model string required
Model ID for the request.
Value: glm-5.2
messages array required
Conversation history.
role
stringrequiredOne of
user,assistant,system, ortool.
content
string | arrayrequiredA text string or a multimodal content array.
thinking object
Controls GLM native thinking. When omitted, the upstream may return message.reasoning_content; send {"type":"disabled"} when only the final answer is needed.
type
string
enabledordisabled.
clear_thinking
booleanClears
reasoning_contentfrom prior turns. Default:true.
reasoning_effort string
Reasoning effort when thinking is enabled. Default: max.
Options: max, xhigh, high, medium, low, minimal, none.
max_tokens integer
Maximum completion token budget, from 1 to 131072. Thinking tokens consume this budget, so reserve sufficient tokens when thinking is enabled.
temperature number
Sampling temperature. Default: 1.0; range: 0.0 to 1.0.
top_p number
Nucleus sampling parameter. Default: 0.95; range: 0.01 to 1.0.
stream boolean
Streams Server-Sent Events (SSE) when true; default: false. Stream chunks use the OpenAI Chat Completions chunk format and end with data: [DONE].
tools array
Tools available to the model, using the OpenAI function tool structure.
type
stringrequired
function.
function
objectrequiredFunction definition.
tool_choice string | object
Tool selection strategy: auto, none, required, or an explicit function selection.
stop string | array
One or more stop sequences; up to four strings.
response_format object
Output-format constraint. Its type may be text or json_object.
Response format
id string
Chat Completion request ID.
object string
Always chat.completion.
created integer
Unix timestamp in seconds for response creation.
model string
Model ID that processed the request.
choices array
One or more completion choices.
index
integerChoice index.
message
objectAssistant message.
role
stringAlways
assistant.content
string | nullFinal answer text.
reasoning_content
string(optional)Reasoning text when thinking is enabled; normally empty or omitted when it is disabled.
finish_reason
stringCompletion reason, such as
stop,length, ortool_calls.
usage object
Token usage for the request.
prompt_tokens
integerInput tokens.
completion_tokens
integerOutput tokens.
total_tokens
integerSum of input and output tokens.
completion_tokens_details.reasoning_tokens
integer(optional)Tokens consumed by thinking.