Chat Completions API

Create a chat completion

Changed on

OpenAI-compatible Chat Completions endpoint. Supports streaming via stream: true, which returns a Server-Sent Events stream of chat.completion.chunk objects.

post/chat/completions

Request

  • Base URL
    https://api.sailresearch.com/v1
  • URL
    https://api.sailresearch.com/v1/chat/completions
  • Auth
    HTTP bearer

Headers

Idempotency-Keystring

Identifies one 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
temperaturenumber nullable
top_pnumber nullable
max_completion_tokensinteger nullable
reasoning_effort'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' nullable

Reasoning effort for the model. max selects the same top tier as xhigh.

n1

Only n=1 is currently supported.

modalitiesstring[]
streamboolean

When true, the response is returned as a Server-Sent Events stream of chat.completion.chunk objects instead of a single JSON response.

storetrue

Only true is supported.

userstring
prompt_cache_keystring

Optional routing hint for prompt-prefix cache locality. Requests with the same key are preferentially routed to maximize cache hit rates.

Response

Chat completion. Returns a single JSON object by default, or a Server-Sent Events stream of chat.completion.chunk objects when stream: true (terminated by a final data: [DONE] line).

idstring required
object'chat.completion' required
createdinteger required
modelstring required
service_tier'asap' | 'balanced' | 'flex'

The completion window Sail selected for this request, including when no window was requested. The legacy request value standard is reported as balanced. Older stored responses may omit this field.

Changes

    • breaking

      removed the enum value priority of the request property /

    • warning

      added the new content_filter enum value to the // response property for the response status (media type: text/event-stream)

    • warning

      added the new length enum value to the // response property for the response status (media type: text/event-stream)

    • 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 balanced enum value to the request property /

    • info

      added the new max enum value to the request property /

    • 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 optional property to the response with the status (media type: text/event-stream)