Skip to main content
POST
Create an Anthropic message

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

anthropic-idempotency-key
string

Identifies one Messages submission within your organization and API key. Reuse the same value and request body when retrying; use a new value for new work. See Idempotency.

Maximum string length: 255
X-Sail-Completion-Window
enum<string>

Completion window for this request, for clients that cannot set metadata.completion_window in the body. A window in the body takes precedence. See Completion windows.

Available options:
asap,
balanced,
flex

Body

application/json
model
string
required
max_tokens
integer
required
Required range: x >= 1
messages
object[]
required
Minimum array length: 1
system

System prompt: a string, or an array of text blocks.

temperature
number
Required range: 0 <= x <= 1
top_p
number
Required range: 0 <= x <= 1
output_config
object
routing
object
tools
object[]

Tool definitions the model may call. Responses include tool_use blocks; return outcomes as tool_result content blocks in a follow-up message.

tool_choice
object

Controls tool use: auto, any, tool, or none.

thinking
object

Extended thinking configuration; translated to the model's reasoning.

stream
boolean

When true, returns Anthropic Server-Sent Events after generation completes. This is not incremental token delivery.

metadata
object

Optional string metadata. completion_window controls scheduling; completion_webhook/webhook_token configure completion webhooks; supercache_write stores a reusable prompt prefix.

context_management
object

Anthropic server-side context-editing config (Claude Code sends it automatically). Accepted for compatibility but ignored: Sail forwards the full context each turn.

cache_control
object

Prompt-cache breakpoint (e.g. { "type": "ephemeral" }). Accepted for Anthropic SDK compatibility and has no effect: Sail caches repeated prompt prefixes automatically, without breakpoints. Cache reads are reported in usage.cache_read_input_tokens.

Response

Anthropic-compatible message response. Returns a single JSON object by default, or an Anthropic Server-Sent Events stream when stream: true.

id
string
required
type
enum<string>
required
Available options:
message
role
enum<string>
required
Available options:
assistant
content
object[]
required
Minimum array length: 1
model
string
required
stop_reason
enum<string>
required
Available options:
end_turn,
max_tokens,
tool_use,
stop_sequence,
refusal,
model_context_window_exceeded
stop_sequence
string | null
required
usage
object
required