Claude Messages API
Calls models through a Claude Messages API-compatible format.
Supports multi-turn conversations and single queries.
Supports text, image, and other multimodal content.
Authorizations
Pass Authorization: Bearer <token> in the request header.
Headers
API version header Specifies the Claude API version to use.
Optional Claude beta feature header. The platform forwards it when provided.
Body
Model name.
glm-5-turbo, glm-5, glm-5.1, glm-5.2, glm-4.7, glm-4.7-flash, glm-4.5-air, MiniMax-M2.5, MiniMax-M2.7, MiniMax-M2.5-highspeed, MiniMax-M2.7-highspeed, MiniMax-M3, qwen3-max, qwen3.5-flash, qwen3.6-plus, qwen3-coder-plus, deepseek-v3-2-251201, deepseek-v4-flash, deepseek-v4-pro, seed-1-6-250915, seed-1-8-251228, seed-2-0-lite-260228, seed-2-0-mini-260215, seed-2-0-pro-260328 Message list
The model uses these messages to generate the next reply. Each message contains role and content fields.
Maximum generated tokens
The maximum number of tokens to generate before stopping. The model may stop before it reaches this limit.
Different models have different maximum values; refer to the model documentation.
max_tokens does not limit the length of the thinking process. When extended thinking is enabled, thinking tokens are controlled separately by thinking.budget_tokens.
x >= 1System prompt used to set the model role or behavior. Pass system as a top-level parameter; the messages array does not accept a system role. Passing a string is equivalent to one type="text" content block. Use the array form when you need explicit cache breakpoints in the system prompt.
Temperature parameter, range [0, 2). Controls output randomness. Higher values make generation more random. This differs from Anthropic's official [0.0, 1.0] range; confirm the value when migrating from Anthropic.
Nucleus sampling probability threshold. It controls output diversity. Both temperature and top_p affect diversity; set only one of them when possible.
Stop sequences
Custom text sequences that stop generation when encountered. After a match, the response stop_reason remains end_turn, and the matched sequence is not returned in the response.
Size of the candidate set used during sampling.
Extended thinking configuration. When enabled, the model reasons before generating the reply to improve answer quality. Some models do not support thinking mode.
Controls the model reasoning effort. The default is max. Supported models: deepseek-v4-pro and deepseek-v4-flash. low or medium maps to high; xhigh maps to max.
high, max Tool definition array for Function Call scenarios.
Tool choice strategy: auto (default, the model decides), any (force a tool call), none (disallow tool calls), or tool (force a specific tool).
- Mode selection
- Specific tool
Structured output configuration. When enabled, the model outputs a JSON string that conforms to the JSON Schema. The deepseek/glm series supports strict structured output with schema constraints. Other models use normal JSON mode, which requires the word 'JSON' in system or messages.
Whether to enable streaming output.
Response
Claude-compatible response.
Claude-compatible message response.
Unique message ID.
Fixed to message.
message Fixed to assistant.
assistant Model name used for generation.
Content array.
- Text
- Thinking process
- Tool call
Stop reason: end_turn for normal completion, max_tokens when the token limit is reached, or tool_use for a tool call.
end_turn, max_tokens, tool_use Fixed to null.
Token usage statistics. In streaming calls, the usage in the message_start event only includes input_tokens and output_tokens; all four fields are returned in the message_delta event.