Messages API

Create an Anthropic message

Changed on

Anthropic-compatible Messages endpoint supporting system prompts, tool calling, and Anthropic SSE framing after generation completes.

post/messages

Request

  • Base URL
    https://api.sailresearch.com/v1
  • URL
    https://api.sailresearch.com/v1/messages
  • Auth
    • HTTP bearer
    • or API key in header x-api-key

Headers

anthropic-idempotency-keystring

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.

X-Sail-Completion-Window'asap' | 'balanced' | 'flex'

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.

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, returns Anthropic Server-Sent Events after generation completes. This is not incremental token delivery.

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' | 'model_context_window_exceeded' required
stop_sequencestring nullable required

Changes

    • breaking

      removed the enum value priority of the request property /

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      added the new api_error enum value to the / response property for the response status

    • warning

      added the new api_error enum value to the / response property for the response status

    • warning

      added the new api_error enum value to the / response property for the response status

    • warning

      added the new authentication_error enum value to the / response property for the response status

    • warning

      added the new authentication_error enum value to the / response property for the response status

    • warning

      added the new authentication_error enum value to the / response property for the response status

    • warning

      added the new billing_error enum value to the / response property for the response status

    • warning

      added the new billing_error enum value to the / response property for the response status

    • warning

      added the new billing_error enum value to the / response property for the response status

    • warning

      added the new conflict_error enum value to the / response property for the response status

    • warning

      added the new conflict_error enum value to the / response property for the response status

    • warning

      added the new conflict_error enum value to the / response property for the response status

    • warning

      added the new invalid_request_error enum value to the / response property for the response status

    • warning

      added the new invalid_request_error enum value to the / response property for the response status

    • warning

      added the new invalid_request_error enum value to the / response property for the response status

    • warning

      added the new model_context_window_exceeded enum value to the response property for the response status (media type: application/json)

    • warning

      added the new not_found_error enum value to the / response property for the response status

    • warning

      added the new not_found_error enum value to the / response property for the response status

    • warning

      added the new not_found_error enum value to the / response property for the response status

    • warning

      added the new overloaded_error enum value to the / response property for the response status

    • warning

      added the new overloaded_error enum value to the / response property for the response status

    • warning

      added the new overloaded_error enum value to the / response property for the response status

    • warning

      added the new permission_error enum value to the / response property for the response status

    • warning

      added the new permission_error enum value to the / response property for the response status

    • warning

      added the new permission_error enum value to the / response property for the response status

    • warning

      added the new rate_limit_error enum value to the / response property for the response status

    • warning

      added the new rate_limit_error enum value to the / response property for the response status

    • warning

      added the new rate_limit_error enum value to the / response property for the response status

    • warning

      added the new request_too_large enum value to the / response property for the response status

    • warning

      added the new request_too_large enum value to the / response property for the response status

    • warning

      added the new request_too_large enum value to the / response property for the response status

    • warning

      added the new timeout_error enum value to the / response property for the response status

    • warning

      added the new timeout_error enum value to the / response property for the response status

    • warning

      added the new timeout_error enum value to the / response property for the response status

    • info

      the endpoint scheme security AnthropicApiKey was added to the API

    • info

      the endpoint scheme security BearerAuth was added to the API

    • info

      added the new optional header request parameter X-Sail-Completion-Window

    • info

      added the new optional request property

    • info

      added the new optional request property /

    • info

      added the new optional request property

    • info

      added the new balanced enum value to the request property /

    • info

      added to the //// request property oneOf list

    • info

      added to the /////////// request property oneOf list

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      removed the non-success response with the status

    • info

      added the optional property / to the response with the status (media type: application/json)

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property / to the response with the status (media type: application/json)

    • info

      added the required property / to the response with the status (media type: application/json)