curl --request POST \
--url https://direct.evolink.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "glm-5.3",
"messages": [
{
"role": "user",
"content": "Please introduce yourself"
}
]
}
'{
"id": "chatcmpl-a6613b56-c61c-94ba-9a9f-43d4cdc7d77a",
"object": "chat.completion",
"request_id": "req-7f3a2c1e8b9d4f0a",
"created": 1777021417,
"model": "glm-5.3",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm GLM-5.3, and I can help you with a variety of tasks such as conversation, reasoning, writing, and code.",
"reasoning_content": "Let me first analyze this problem...",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 346,
"total_tokens": 370,
"prompt_tokens_details": {
"cached_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 321
}
},
"web_search": [
{
"icon": "<string>",
"title": "<string>",
"link": "<string>",
"media": "<string>",
"publish_date": "<string>",
"content": "<string>",
"refer": "<string>"
}
],
"content_filter": [
{
"role": "assistant",
"level": 1
}
]
}{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"code": 401,
"message": "Invalid or expired token",
"type": "authentication_error"
}
}{
"error": {
"code": 402,
"message": "Insufficient quota",
"type": "insufficient_quota_error",
"fallback_suggestion": "https://evolink.ai/dashboard/credits"
}
}{
"error": {
"code": 403,
"message": "Access denied for this model",
"type": "permission_error",
"param": "model"
}
}{
"error": {
"code": 404,
"message": "Specified model not found",
"type": "not_found_error",
"param": "model",
"fallback_suggestion": "glm-5.3"
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded",
"type": "rate_limit_error",
"fallback_suggestion": "retry after 60 seconds"
}
}{
"error": {
"code": 500,
"message": "Internal server error",
"type": "internal_server_error",
"fallback_suggestion": "try again later"
}
}{
"error": {
"code": 123,
"message": "<string>",
"type": "<string>",
"param": "<string>",
"fallback_suggestion": "<string>"
}
}{
"error": {
"code": 503,
"message": "Service temporarily unavailable",
"type": "service_unavailable_error",
"fallback_suggestion": "retry after 30 seconds"
}
}GLM All-Model API - Chat Completions Reference
- Call GLM series models through the OpenAI Chat Completions protocol, choosing the specific model with the
modelparameter - Synchronous processing that returns the conversation content in real time
- Text conversation: single-turn or multi-turn contextual conversation;
glm-5.3-flashandglm-5.3-flashxadditionally support image input - System prompt: customise the AI’s role and behaviour through a
role=systemmessage - Deep thinking:
thinking.typecontrols the chain of thought andreasoning_effortadjusts the reasoning depth; the reasoning is returned inreasoning_content - Streaming: SSE streaming responses are supported (
stream=true) - Tool calling: function calling and web search are supported (
web_search, up to 128 tools) - Structured output: JSON mode is enabled through
response_format
About streaming responses: when stream=true, results come back over Server-Sent Events, each message formatted as data: {JSON} and the stream ending with data: [DONE]. Each chunk (ChatCompletionChunk) carries id, created, model, choices and optionally usage and content_filter; inside it, choices[].delta returns incremental role / content / reasoning_content / tool_calls, and choices[].finish_reason gives the termination reason in the final chunk.
curl --request POST \
--url https://direct.evolink.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "glm-5.3",
"messages": [
{
"role": "user",
"content": "Please introduce yourself"
}
]
}
'{
"id": "chatcmpl-a6613b56-c61c-94ba-9a9f-43d4cdc7d77a",
"object": "chat.completion",
"request_id": "req-7f3a2c1e8b9d4f0a",
"created": 1777021417,
"model": "glm-5.3",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm GLM-5.3, and I can help you with a variety of tasks such as conversation, reasoning, writing, and code.",
"reasoning_content": "Let me first analyze this problem...",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 346,
"total_tokens": 370,
"prompt_tokens_details": {
"cached_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 321
}
},
"web_search": [
{
"icon": "<string>",
"title": "<string>",
"link": "<string>",
"media": "<string>",
"publish_date": "<string>",
"content": "<string>",
"refer": "<string>"
}
],
"content_filter": [
{
"role": "assistant",
"level": 1
}
]
}{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"code": 401,
"message": "Invalid or expired token",
"type": "authentication_error"
}
}{
"error": {
"code": 402,
"message": "Insufficient quota",
"type": "insufficient_quota_error",
"fallback_suggestion": "https://evolink.ai/dashboard/credits"
}
}{
"error": {
"code": 403,
"message": "Access denied for this model",
"type": "permission_error",
"param": "model"
}
}{
"error": {
"code": 404,
"message": "Specified model not found",
"type": "not_found_error",
"param": "model",
"fallback_suggestion": "glm-5.3"
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded",
"type": "rate_limit_error",
"fallback_suggestion": "retry after 60 seconds"
}
}{
"error": {
"code": 500,
"message": "Internal server error",
"type": "internal_server_error",
"fallback_suggestion": "try again later"
}
}{
"error": {
"code": 123,
"message": "<string>",
"type": "<string>",
"param": "<string>",
"fallback_suggestion": "<string>"
}
}{
"error": {
"code": 503,
"message": "Service temporarily unavailable",
"type": "service_unavailable_error",
"fallback_suggestion": "retry after 30 seconds"
}
}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.disabled turns it off only on glm-5.2.glm-5.3, glm-5.3-flash and glm-5.3-flashx always think. Passing disabled retains the default thinking mode; it neither disables thinking nor sets the effort to low. To reduce effort, set reasoning_effort=low. After switching from glm-5.2 to the 5.3 series, thinking remains enabled and thinking tokens are billed as output even if thinking.type=disabled is retained.reasoning_effort: Reasoning effort, default max.
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.
glm-5.2 supports max, xhigh, high, medium, low, minimal and none. xhigh is equivalent to max; medium / low are equivalent to high; minimal / none can disable thinking. thinking.type=disabled can also turn it off. Use max for complex tasks such as coding.
- String: plain text, supported by every model
- Content block array: text and images mixed, supported only by
glm-5.3-flashandglm-5.3-flashx
glm-5.3 or glm-5.2 returns an error.Authorizations
##All APIs require Bearer Token authentication##
Get API Key:
Visit API Key Management Page to get your API Key
Add to request header:
Authorization: Bearer YOUR_API_KEY
Body
Model to call:
| Model ID | Positioning | Thinking control | Image input |
|---|---|---|---|
glm-5.3 | Flagship model, with across-the-board gains on complex software engineering and agent tasks and a large step up in coding; 1M context | Always enabled; effective levels: low / high / max. See reasoning_effort for compatible values. | Not supported |
glm-5.3-flash | Lightweight multimodal model with a hybrid sparse and linear attention architecture, extremely low cost and native vision; 1M context | Same as glm-5.3 | Supported, see the messages field |
glm-5.3-flashx | Multimodal model with image input; 1M context | Same as glm-5.3 | Supported, see the messages field |
glm-5.2 | Previous-generation flagship, complex reasoning and very long context; 1M context | Can be turned off with thinking.type: "disabled"; reasoning_effort supports all 7 levels | Not supported |
glm-5.3, glm-5.3-flash, glm-5.3-flashx, glm-5.2 "glm-5.3"
The list of conversation messages, containing the full context of the current conversation
Supports four roles: system, user, assistant, tool. Messages of different roles have different field structures; please select the corresponding role to view details. Must contain at least 1 message, and cannot consist solely of system or assistant messages.
1- System Message
- User Message
- Assistant Message
- Tool Message
Show child attributes
Show child attributes
Whether to enable streaming output mode
false: The model generates the complete response and returns it all at once (default), suitable for short text and batch processingtrue: Returns chunks in real time via Server-Sent Events (SSE), suitable for chat and long text; returnsdata: [DONE]when the stream ends
false
Controls whether to enable the chain of thought (Chain of Thought)
Show child attributes
Show child attributes
Reasoning effort, default max.
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.
glm-5.2 supports max, xhigh, high, medium, low, minimal and none. xhigh is equivalent to max; medium / low are equivalent to high; minimal / none can disable thinking. thinking.type=disabled can also turn it off. Use max for complex tasks such as coding.
max, xhigh, high, medium, low, minimal, none "max"
Whether to enable the sampling strategy
true(default): Usestemperature/top_pfor random sampling, producing more varied outputfalse: Always selects the highest-probability token (greedy decoding), producing more deterministic output; in this casetemperatureandtop_pare ignored
For tasks requiring consistency and reproducibility (such as code generation and translation), setting this to false is recommended
true
Sampling temperature, controlling the randomness and creativity of the output
Notes:
- Value range:
[0.0, 1.0], limited to two decimal places - Higher values (e.g. 0.8): more random and creative, suitable for creative writing
- Lower values (e.g. 0.2): more stable and deterministic, suitable for factual Q&A and code generation
- Default value:
1.0
Recommendation: Do not adjust both temperature and top_p at the same time
0 <= x <= 11
Nucleus Sampling parameter, an alternative to temperature sampling
Notes:
- Value range:
[0.01, 1.0], limited to two decimal places - The model only considers candidate tokens whose cumulative probability reaches
top_p; for example, 0.1 means only the top 10% probability tokens are considered - Smaller values produce more focused and consistent output; larger values increase diversity
- Default value:
0.95
Recommendation: Do not adjust both temperature and top_p at the same time
0.01 <= x <= 10.95
Upper limit on the number of output tokens
Note:
- The GLM series supports up to 131,072 tokens (128K) of output; setting at least
1024is recommended - When
thinkingis on, chain-of-thought tokens also count towards this limit - If generation is cut off with
length, try raising this value
1 <= x <= 1310721024
The list of tools the model may call
Note:
- Function calling (
function) and web search (web_search) are supported - Up to 128 functions
- Of these,
web_searchis billed separately per call when a search actually happens; the other tools carry no extra charge
128- Function Tool
- Web Search Tool (Web Search)
Show child attributes
Show child attributes
Controls how the model selects which function to call
Notes: Only takes effect when the tool type is function; defaults to and only supports auto (the model automatically decides whether to call a tool)
auto "auto"
The list of stop words
Notes:
- When the generated text encounters a specified string, generation stops immediately (the stop word itself is not included in the returned text)
- Currently only a single stop word is supported, in the format
["stop_word1"], for example["Human:"]
4["Human:"]
Specifies the model's response output format; defaults to text
Notes:
{ "type": "json_object" }enables JSON mode, and the model returns valid JSON-formatted data, suitable for scenarios such as structured data extraction- When using JSON mode, it is recommended to explicitly request JSON output in the
systemorusermessage
Show child attributes
Show child attributes
Unique request identifier
Notes:
- Passed by the client, 6-64 characters long; using UUID format is recommended to ensure uniqueness
- If not provided, the platform will generate one automatically
6 - 64"req-7f3a2c1e8b9d4f0a"
Unique identifier of the end user
Notes: 6-128 characters long; using a unique identifier that does not contain sensitive information is recommended, which can help the platform monitor and detect abusive behavior
6 - 128"user-abc123456"
Response
Chat completion generated successfully
Task ID
"chatcmpl-a6613b56-c61c-94ba-9a9f-43d4cdc7d77a"
Response type
chat.completion "chat.completion"
Request ID (returned when request_id is provided in the request)
"req-7f3a2c1e8b9d4f0a"
Request creation time, Unix timestamp (seconds)
1777021417
Model name
"glm-5.3"
The list of model responses
Show child attributes
Show child attributes
Token usage statistics returned when the call ends
Show child attributes
Show child attributes
Web search-related information, returned when the web_search tool is used and a search is triggered
Show child attributes
Show child attributes
Content safety-related information
Show child attributes
Show child attributes