Messages
Creates a message. Compatible with the Anthropic Messages protocol.
Authorizations
API key used for request authentication. Obtain an API key before using the API. Note: A payment method is required to use the API.
Headers
Anthropic protocol version, e.g. 2023-06-01. Sent automatically by the Anthropic SDK. Defaults to 2023-06-01 if omitted.
Body
Request body for the Messages API. Some parameters apply only to certain models; unsupported parameters are ignored.
The model to use. Anthropic models also accept their native ids (e.g. claude-opus-4-8), which map to anthropic/claude-opus-4.8.
anthropic/claude-opus-4.8, anthropic/claude-opus-4.6, anthropic/claude-sonnet-4.6, anthropic/claude-haiku-4.5, google/gemini-3.5-flash, google/gemini-3.1-pro-preview, google/gemini-3.1-flash-lite, google/gemini-3-flash-preview, openai/gpt-5.5-pro, openai/gpt-5.5, openai/gpt-5.4, moonshotai/kimi-k2.6, moonshotai/kimi-k2.5, minimax/minimax-m2.5, qwen/qwen3.6-plus Maximum number of tokens to generate.
x >= 1The conversation in chronological order.
System prompt.
Tool definitions. Supports custom tools and the built-in octen_search server tool.
Controls whether and how the model calls tools.
Whether to enable streaming output.
Controls randomness.
0 <= x <= 1Nucleus sampling. Set only one of temperature and top_p.
x <= 1Sample only from the top K tokens.
x >= 0Stop sequences.
Thinking options for reasoning models.
Request metadata.
Response
Successful message response. When stream=false, returns a single message object. When stream=true, returns an Anthropic SSE event stream.
A non-streaming response. Returned when stream=false.
The unique identifier for this request.
The response type. message on success.
message, error Always assistant.
assistant The model used for this response.
The response content, as a list of content blocks.
Why the model stopped. end_turn is normal; tool_use means it awaits a custom tool result; pause_turn (Anthropic models only) means a long-running turn was paused, replay the returned content to continue.
end_turn, max_tokens, stop_sequence, tool_use, pause_turn, refusal Token usage information.
The stop sequence that was hit, or null.