v1

latestOpenAPI 3.1.02026-07-26105141.0 KB
Messages API

Create an Anthropic message

Anthropic-compatible Messages endpoint supporting system prompts, tool calling, and streaming (SSE).

post/messages

Headers

anthropic-idempotency-keystring

Anthropic-compatible idempotency header. Same semantics as Idempotency-Key; used on the /messages endpoint to match Anthropic's conventions.

Request body

modelstring required
max_tokensinteger required
temperaturenumber
top_pnumber
toolsobject[]

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

tool_choiceobject

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

thinkingobject

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

streamboolean

When true, the response streams as Anthropic Server-Sent Events (message_start, content_block_delta, message_stop, …).

context_managementobject

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

Response

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

idstring required
type'message' required
role'assistant' required
modelstring required
stop_reason'end_turn' | 'max_tokens' | 'tool_use' | 'stop_sequence' | 'refusal' required
stop_sequencestring nullable required