Responses API
Supported features
Supercache usage
When Supercache accounting data is available, completed Responses includemetadata.supercached_input_tokens and
metadata.supercache_write_input_tokens as decimal strings. Both fields are
included when their value is zero. usage.input_tokens_details.cached_tokens
includes tokens read from Supercache. The two metadata keys are reserved and
cannot be set in a request.
Response status and output validation
Treatcompleted, incomplete, failed, and cancelled as terminal statuses
when polling a background response.
completedmeans the response finished normally.incompletemeans generation stopped early. A reason of"max_output_tokens"is Sail’s normalized truncation/cap reason: it is reported whenever generation stops because of a length-based limit, such as the request’smax_output_tokens, the model’s context window, or another provider length signal. It does not by itself prove the request’s output limit alone was reached. A reason of"content_filter"means generation stopped because of a content filter. When present,usageis preserved. A response limited bymax_output_tokenscan include partialoutput; tokens reported inusageare billed normally. An incomplete response is not an API error.failedincludes generations that Sail rejects because the result does not satisfy the request after its retry attempts are exhausted. A request withtool_choice: "required"can fail witherror.code: "server_error"and the message"The model did not return a tool call required by the request."A generation with no visible text, refusal, or tool call can fail witherror.code: "server_error"and the message"The model did not return visible text, a refusal, or a tool call."instead of returning an empty completed response.cancelledmeans no further output will be produced.
Not yet supported
Chat Completions API
OpenAI SDK compatibleAPI reference
Supported features
Not yet supported
Response notes
- Responses always contain exactly one choice (
n=1). finish_reasonreflects the provider result when available, including"stop","tool_calls","length", and"content_filter".system_fingerprintandservice_tierare not included in responses.logprobsis alwaysnull.
Messages API
The Messages API is Anthropic-compatible for agentic use: system prompts, tool
calling, and streaming (SSE) are supported. Prompt caching (
cache_control)
is accepted but not yet applied.Supported features
Not yet supported
Response notes
stop_reasonreflects the outcome. Sail returns"end_turn"normally,"tool_use"for tool calls,"max_tokens"for token limits, and"refusal"when the provider reports a refusal. Sail returns"model_context_window_exceeded"when the provider reports that the model’s context window was exceeded.- Responses contain
textcontent blocks, plustool_useblocks when the model calls a tool. - Cache-related usage fields (
cache_creation_input_tokens,cache_read_input_tokens) are not included (prompt caching isn’t applied yet). - Thinking output does not include an Anthropic cryptographic signature.
thinking.budget_tokensis approximated as medium reasoning effort unlessoutput_config.effortprovides an explicit effort. - When reasoning is present, Messages content begins with a
thinkingblock before the text block. Select content by block type rather than assumingcontent[0]is text. The Chat Completions response exposes the same reasoning throughreasoning_content. - Token counting applies the same replay-block policy as message creation: redacted thinking is omitted and tool-result images count as the replacement text marker.
- Non-streaming requests wait for up to nine minutes. If generation is still
running, Sail returns a
408 timeout_errorand includes the response ID inX-Sail-Message-Id. Sail also returnsX-Should-Retry: falseso Anthropic SDKs do not create a second task. The original task continues. Retrieve it withGET /v1/messages/{id}, or usestream: truefor long-running requests. Streaming requests use heartbeats and remain connected for up to 20 minutes. If that wait expires, the stream emits a timeout error with the response ID. The task continues and remains retrievable withGET /v1/messages/{id}.
Compatibility notes
- Sail accepts both the Anthropic
x-api-keyheader andAuthorization: Bearer <key>. If both are present,Authorizationtakes precedence.
- The Anthropic Python and TypeScript SDKs type
metadatawith onlyuser_id. Sail also acceptscompletion_window. Keep the additional cast or type assertion scoped to themetadatavalue:
- The
anthropic-versionheader is not required or checked. - Errors use the Anthropic envelope
{"type":"error","error":{"type":"...","message":"..."},"request_id":"..."}and Anthropic error types such asinvalid_request_error,rate_limit_error, andoverloaded_error.
Batch API
The Batch API runs large numbers of Responses API requests asynchronously. Every item targets/v1/responses. Batching /v1/chat/completions or /v1/messages is not currently supported. You can submit up to 100,000 requests in a single POST /v1/batches call, then poll GET /v1/batches/{id} for status and fetch each result by custom_id.
See Sending Requests at Scale for the end-to-end workflow and the Batch API reference for the request and response schemas.
Cross-API behavior
These behaviors apply across the inference API surfaces:- Streaming: The Chat Completions API supports
stream: true, returning Server-Sent Events (chat.completion.chunk); setstream_options.include_usagefor a final usage chunk. The Messages API supportsstream: true, returning Anthropic SSE events after generation completes rather than incremental token delivery. The Responses API supports foregroundstream: true, returning OpenAI Responses SSE events.background: truerequests return202immediately and cannot be streamed; use polling or webhooks for long-running background work. - Completion windows: Express latency tolerance in exchange for lower token costs. See Completion Windows and Pricing.
- Context windows: For each text request, Sail reserves at least 512 tokens,
or 0.5% on larger windows, from the model’s published context window. The
input token count plus the requested maximum output must fit in the remaining
budget. This allowance covers model-specific request formatting that can add
tokens when the request runs. On the non-batch Responses endpoint
(
POST /v1/responses), requests that provideraw_prompt_tokensskip text formatting and use the exact raw-token count without this reserve, requiring the raw token count plusmax_output_tokensto fit within the model’s context window. The Batch API does not yet apply thisraw_prompt_tokensadmission arithmetic. - Webhooks: Set
metadata.completion_webhookto receive a POST when processing finishes. See Webhooks. - Response storage:
store: falseis accepted for OpenAI compatibility, but does not change Sail’s normal temporary request/response storage for processing, retries, polling, and idempotency. Customer Data remains governed by Sail’s DPA retention and deletion terms.