{
"id": "response_demo",
"object": "response",
"created_at": 1789971757,
"model": "glm-5.3-flash",
"status": "completed",
"output": [
{
"type": "message",
"id": "message_demo",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Hello, I am GLM. I can help with conversation, writing and coding.",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 17,
"output_tokens": 24,
"total_tokens": 41,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"error": null
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}GLM All-Model API - Responses Reference
Call GLM in Responses format for text conversations, streaming and function calling, with image understanding and web search available according to the model. See the parameters and model differences below.
{
"id": "response_demo",
"object": "response",
"created_at": 1789971757,
"model": "glm-5.3-flash",
"status": "completed",
"output": [
{
"type": "message",
"id": "message_demo",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Hello, I am GLM. I can help with conversation, writing and coding.",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 17,
"output_tokens": 24,
"total_tokens": 41,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"error": null
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}https://direct.evolink.ai, which has better support for text models and long-lived connections. https://api.evolink.ai is the primary endpoint for multimodal services and serves as a fallback address for text models.Models and parameter differences
Choose a GLM model. All four support text on this endpoint. Optional capabilities vary by model.| Model ID | Input | Reasoning notes |
|---|---|---|
glm-5.3 | Text | Effective levels: low / high / max; compatible values are listed under reasoning. Thinking cannot be disabled. |
glm-5.3-flash | Text, images | Same as glm-5.3; use input_image for images. |
glm-5.3-flashx | Text, images | Same as glm-5.3; use input_image for images. |
glm-5.2 | Text | none may still produce reasoning tokens and does not guarantee that thinking is disabled. |
reasoning.effort, rather than top-level reasoning_effort or thinking. Reasoning usage is included in output_tokens. Simple tasks may return reasoning_tokens=0; this does not imply that thinking can be disabled.
Reasoning effort; low is recommended.
Compatibility rules for glm-5.3 / glm-5.3-flash / glm-5.3-flashx
| Supplied value | Effective thinking level |
|---|---|
low / high / max | Unchanged |
xhigh | max |
medium | high |
minimal / none | low; thinking remains enabled |
minimal and none do not disable thinking on the 5.3 series. Thinking tokens are billed as output. Unrecognized values are unchanged and have no compatibility mapping; use the listed values. These mappings do not apply to glm-5.2.
On this endpoint, glm-5.2 may still produce reasoning tokens with none. This value does not guarantee that thinking is disabled.
System prompts and multi-turn conversations
instructions: System instructions. glm-5.3-flash supports this field when input is a string. When input is a message array, put the system prompt in the first role=system message.
{
"model": "glm-5.3-flash",
"input": [
{
"role": "system",
"content": "Answer concisely in English."
},
{
"role": "user",
"content": "Remember the passphrase RED-583"
},
{
"role": "assistant",
"content": "Remembered"
},
{
"role": "user",
"content": "What is the passphrase? Reply with only the passphrase."
}
],
"reasoning": {
"effort": "low"
},
"max_output_tokens": 1024
}
glm-5.3-flash and glm-5.3-flashx support multi-turn conversations using store=true with previous_response_id. glm-5.2 does not support response-ID continuation; store=true does not enable it. Include the full history in input instead.
The top-level id of the previous response. glm-5.3-flash and glm-5.3-flashx support this with store=true and the same model. Pass the response id unchanged, not an item id from output. glm-5.2 returns 400 for this field. For conversations across models, omit it and include the full history in input.
Streaming responses
Enable SSE streaming. Read answer text from delta in response.output_text.delta. The successful terminal event is response.completed. Also end the turn and handleresponse.incomplete, response.failed or error. Do not wait only for [DONE] or connection closure.
| Event | Handling |
|---|---|
response.created / response.in_progress | The turn starts. |
response.output_text.delta | Append delta to the answer text. |
response.reasoning_text.delta / response.reasoning_summary_text.delta | Reasoning content; keep it separate from the answer and support both event forms. |
response.output_item.done | Collect the complete output item, such as function_call. |
response.completed | Generation has ended; read response.output and response.usage. |
response.incomplete / response.failed / error | Handle truncation or errors and end the turn. |
response.completed and still require your application to execute the function and send another request.
Function calling
Choose the function example in the request menu. Responses function definitions use a flat structure:{
"type": "function",
"name": "get_temperature",
"description": "Return the temperature for the specified city",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string"
}
},
"required": [
"city"
],
"additionalProperties": false
}
}
- Traverse
response.outputand collect all items with type=function_call. - Parse and validate the arguments JSON string, then execute each function in your application.
- Append the entire previous output to the history. Add a
function_call_outputfor each call, using the originalcall_idand a string output. - Send the updated history as input in the next request. The function-result example shows this structure.
parallel_tool_calls: Whether multiple tools may be called in a turn. false does not guarantee a single function call. Clients should traverse and handle every function_call.Images, search and JSON output
Forglm-5.3-flash and glm-5.3-flashx, mix input_text and input_image in the user message content array. Pass a public image URL or Base64 Data URL in image_url. Use text only for glm-5.3 and glm-5.2.
Declare tools: [{"type":"web_search"}]. Search runs on the server and returns web_search_call items and answer text. Check the output items to see whether search was used. Searches may incur per-call fees in addition to token charges; see model pricing.
To continue after a search, append the entire previous output, including web_search_call and message, to input, then add your new question. Preserve original fields such as id, status, and action. The server has already executed the search, so do not create a function_call_output for web_search_call. See the web_search_history request example.
text.format.type: Output format: text for plain text or json_object for a JSON object. With json_object, explicitly request valid JSON in the prompt and parse and validate it in your client. Strict JSON Schema constraints are not provided; do not rely on json_schema or strict=true to enforce a structure.
Responses and usage
Ordered output items. Extract text from content entries withtype=output_text inside type=message items. Reasoning may precede the answer, and function_call turns may contain no answer text. Do not always read output[0].
output_text: Optional aggregated answer text; it may be absent. General-purpose clients should traverse output.
output_text in message items; possibly reasoning_text in reasoning items. Reasoning may also be returned as summary_text. Do not assume every reasoning item has content.
usage.input_tokens: Total input tokens, including cached tokens.usage.input_tokens_details.cached_tokens: Cached subset of input tokens; do not add it toinput_tokensagain. Prefix caching is automatic and requires no explicit cache_control. Use the returned value for the number of cache hits.usage.output_tokens: Total output tokens, including reasoning tokens.usage.output_tokens_details.reasoning_tokens: Subset of output tokens used for reasoning; do not count it again in output_tokens. This detail may be absent or zero.
status=incomplete with incomplete_details.reason=max_output_tokens means the budget was exhausted. There may be reasoning without an answer; increase the output limit.Authorizations
Send Bearer YOUR_API_KEY in the Authorization header.
Body
Choose a GLM model. All four support text on this endpoint. Optional capabilities vary by model.
| Model ID | Input | Reasoning notes |
|---|---|---|
glm-5.3 | Text | Effective levels: low / high / max; compatible values are listed under reasoning. Thinking cannot be disabled. |
glm-5.3-flash | Text, images | Same as glm-5.3; use input_image for images. |
glm-5.3-flashx | Text, images | Same as glm-5.3; use input_image for images. |
glm-5.2 | Text | none may still produce reasoning tokens and does not guarantee that thinking is disabled. |
glm-5.3, glm-5.3-flash, glm-5.3-flashx, glm-5.2 "glm-5.3-flash"
Required. A text string or an array of Responses input items. Arrays accept messages, returned model output items and function_call_output. For multi-turn conversations, include the full history in each request. Put the system prompt first as a role=system message. Images use input_image, supported only by glm-5.3-flash and glm-5.3-flashx. Do not use the Chat Completions messages / image_url block format.
"Introduce yourself in one sentence."
Maximum output tokens for this generation, including reasoning. Start at 1024 and adjust for the task. A small budget may be exhausted during reasoning, leaving only reasoning items and no answer. Check status and incomplete_details. The parameter name is max_output_tokens, not max_tokens.
x >= 11024
Enable SSE streaming. Read answer text from delta in response.output_text.delta. The successful terminal event is response.completed. Also end the turn and handle response.incomplete, response.failed or error. Do not wait only for [DONE] or connection closure.
Responses uses nested reasoning.effort, rather than top-level reasoning_effort or thinking. Reasoning usage is included in output_tokens. Simple tasks may return reasoning_tokens=0; this does not imply that thinking can be disabled.
Show child attributes
Show child attributes
System instructions. glm-5.3-flash supports this field when input is a string. When input is a message array, put the system prompt in the first role=system message.
Supports client-side function tools and server-side web_search. Declare functions with flat name / description / parameters fields, not a nested Chat Completions function object. Your application executes function_call and returns the result. web_search runs on the server; actual searches may incur per-call charges in addition to tokens. See model pricing.
- Option 1
- Option 2
Show child attributes
Show child attributes
auto lets the model choose; none disables tools; required requires a tool call. To select a function, use {"type":"function","name":"get_temperature"}. Forced selection behavior is not guaranteed to be identical for every model and tool combination.
auto, none, required "auto"
Whether multiple tools may be called in a turn. false does not guarantee a single function call. Clients should traverse and handle every function_call.
Output format. Examples use json_object. HTTP 200 does not guarantee JSON Schema compliance.
Show child attributes
Show child attributes
Store the response for later reference. glm-5.3-flash and glm-5.3-flashx support multi-turn conversations using store=true with previous_response_id. glm-5.2 does not support response-ID continuation; store=true does not enable it. Include the full history in input instead.
The top-level id of the previous response. glm-5.3-flash and glm-5.3-flashx support this with store=true and the same model. Pass the response id unchanged, not an item id from output. glm-5.2 returns 400 for this field. For conversations across models, omit it and include the full history in input.
"Response ID returned in the previous turn"
Custom string key-value metadata, available in response metadata. Do not include keys or sensitive information.
Show child attributes
Show child attributes
{ "conversation": "demo" }
Sampling parameter. The effective range and behavior depend on the model. It does not guarantee deterministic output and can be omitted for reasoning tasks.
Sampling parameter. The effective range and behavior depend on the model. It can usually be omitted.
Response
Generation completed or returned an incomplete result; check status. Streaming returns text/event-stream.
ID of this response. Pass it unchanged as previous_response_id.
"response_demo"
"response"Creation time in Unix seconds.
"glm-5.3-flash"
completed means generation for this turn has ended, possibly with tool calls only. incomplete means the output is incomplete. Check both output and error.
completed, incomplete, failed, in_progress, queued Ordered output items. Extract text from content entries with type=output_text inside type=message items. Reasoning may precede the answer, and function_call turns may contain no answer text. Do not always read output[0].
Show child attributes
Show child attributes
Optional aggregated answer text; it may be absent. General-purpose clients should traverse output.
Show child attributes
Show child attributes
Response error, normally null on success.
Show child attributes
Show child attributes
Show child attributes
Show child attributes