Skip to main content
POST
Creates a message. Pass stream: true to stream the message as server-sent events.

Body

string
required
Model tag.
integer
required
Maximum number of tokens to generate.
MessageParam[]
required
Input messages. Content blocks can be text, image, tool_use, or tool_result.
string | TextBlock[]
System prompt.
boolean
Whether to stream the message as server-sent events. Defaults to false.
Tool[]
Tools the model may call.
ThinkingConfig
Extended thinking configuration: { "type": "disabled" }, { "type": "enabled", "budget_tokens": N }, or { "type": "adaptive" }. Mapped onto the model’s reasoning effort.
string
Reasoning effort: low, medium, high, xhigh, or max.
number
Sampling temperature.
number
Nucleus sampling coefficient.
integer
Only sample from the top K options for each token. Ignored by models that do not support it.
string[]
Custom text sequences that stop generation. Ignored by models that do not support it.

Response

string
required
Message identifier.
string
required
Object type, always message.
string
required
Message role, always assistant.
string
required
Model tag.
ContentBlock[]
required
Generated content. Blocks can be text, thinking, or tool_use.
string
Reason the model stopped generating: end_turn, max_tokens, stop_sequence, or tool_use.
string
Custom stop sequence that was generated, if any.
Usage
required
Token usage.