GLM All-Model API - Messages Quickstart
- Call GLM series models through the Anthropic Messages protocol, choosing the specific model with the
modelparameter model,max_tokensandmessagesare the only parameters you need (max_tokensis mandatory in the Anthropic protocol)- 1M token context window across the series, with up to 131,072 output tokens
- Thinking is on by default across the series, so the response
contentcarries atype="thinking"block, and that part counts towards output tokens - For streaming, tool calls, image input and other capabilities, see the Reference page
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.content array carries a type="thinking" block, and that part counts towards output tokens. So max_tokens should not be set too low; 1024 or higher is recommended, otherwise the response may be truncated before the thinking finishes and you get no answer text.Authorizations
##All interfaces require authentication using a Bearer Token##
Get an API Key:
Visit the API Key management page to obtain your API Key
Add it to the request header when using:
Note: EvoLink uses Bearer Token authentication uniformly for /v1/messages.
Body
Model to call:
glm-5.3, glm-5.3-flash, glm-5.2 "glm-5.3"
Maximum number of tokens to generate for this request; required by the Anthropic protocol.
Note: the GLM series has thinking on by default, and the thinking content also consumes output tokens, so this value should not be too small — 1024 or higher is recommended.
1 <= x <= 1310721024
The list of conversation messages, in chronological order. At least one message is required.
1Response
Message object
Anthropic-style message response
The message's unique ID (format: msg_<uuid>)
Response object type
message assistant Model actually used
"glm-5.3"
The list of response content blocks
Possible block types:
thinking: the reasoning process (when thinking is enabled, which is the default)text: the final answer texttool_use: a tool call initiated by the model
Stop reason
end_turn: natural completion (also returned when stop_sequences is hit)max_tokens: reached the max_tokens limittool_use: the model triggered a tool call
end_turn, max_tokens, tool_use Token usage statistics (Anthropic specification)