Sail Research Chat Completions API API
OpenAI-compatible Chat Completions API endpoints.
OpenAI-compatible Chat Completions API endpoints.
openapi: 3.1.0
info:
title: Sail Batches API Chat Completions API API
version: '2026-02-18'
description: Sail provides OpenAI-compatible Responses and Chat Completions endpoints, plus an Anthropic-compatible Messages endpoint. This reference documents the currently supported subset of fields.
servers:
- url: https://api.sailresearch.com/v1
security:
- BearerAuth: []
tags:
- name: Chat Completions API
description: OpenAI-compatible Chat Completions API endpoints.
paths:
/chat/completions:
post:
operationId: createChatCompletion
tags:
- Chat Completions API
summary: Create a chat completion
description: 'OpenAI-compatible Chat Completions endpoint. Supports streaming via stream: true, which returns a Server-Sent Events stream of chat.completion.chunk objects.'
parameters:
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateChatCompletionRequest'
example:
model: zai-org/GLM-5.2-FP8
messages:
- role: system
content: You are a concise assistant.
- role: user
content: Summarize retrieval-augmented generation in 3 bullets.
max_completion_tokens: 300
responses:
'200':
description: '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).'
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionResponse'
text/event-stream:
schema:
$ref: '#/components/schemas/ChatCompletionChunk'
'400':
description: Invalid request or unsupported feature.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Authentication error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'408':
description: Timed out waiting for completion.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Server error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
ErrorObject:
type: object
required:
- message
- type
properties:
message:
type: string
type:
type: string
param:
oneOf:
- type: string
- type: 'null'
code:
oneOf:
- type: string
- type: integer
- type: 'null'
additionalProperties: true
ChatResponseFormatText:
type: object
required:
- type
properties:
type:
type: string
enum:
- text
additionalProperties: false
ChatCompletionChoice:
type: object
required:
- index
- message
- logprobs
- finish_reason
properties:
index:
type: integer
message:
$ref: '#/components/schemas/ChatCompletionResponseMessage'
logprobs:
type: 'null'
finish_reason:
type: string
enum:
- stop
- length
- tool_calls
- content_filter
- function_call
additionalProperties: false
ChatImageContentPart:
type: object
description: Image content part. Image input is supported only on multimodal models; see the Models page.
required:
- type
- image_url
properties:
type:
type: string
enum:
- image_url
image_url:
type: object
required:
- url
properties:
url:
type: string
description: Public http(s) URL or a base64 data URI.
detail:
type: string
enum:
- auto
- low
- high
additionalProperties: false
additionalProperties: false
ErrorResponse:
type: object
required:
- error
properties:
error:
$ref: '#/components/schemas/ErrorObject'
additionalProperties: false
RequestMetadata:
type: object
description: Optional string metadata. completion_window controls scheduling; completion_webhook/webhook_token configure completion webhooks.
properties:
completion_window:
type: string
description: '[Completion window](/completion-windows) (i.e. latency tier) for the request. Support matrix is available on the [Pricing](/pricing) page. When omitted, defaults to `standard` if that window is supported for the model; otherwise `flex` for async requests when the model supports it, and `asap` in all other cases. See [default behavior](/completion-windows#default-behavior).'
enum:
- asap
- priority
- standard
- flex
completion_webhook:
type: string
format: uri
webhook_token:
type: string
additionalProperties:
type: string
ChatTextContentPart:
type: object
required:
- type
- text
properties:
type:
type: string
enum:
- text
text:
type: string
additionalProperties: false
ChatCompletionChunkToolCall:
type: object
properties:
index:
type: integer
id:
type: string
type:
type: string
function:
$ref: '#/components/schemas/ChatCompletionChunkToolCallFunction'
custom:
$ref: '#/components/schemas/ChatCompletionChunkToolCallFunction'
additionalProperties: false
ChatCompletionChunkToolCallFunction:
type: object
properties:
name:
type: string
arguments:
type: string
input:
type: string
additionalProperties: false
CreateChatCompletionRequest:
type: object
required:
- model
- messages
properties:
model:
type: string
messages:
type: array
minItems: 1
items:
$ref: '#/components/schemas/ChatCompletionMessage'
temperature:
oneOf:
- type: number
minimum: 0
maximum: 2
- type: 'null'
top_p:
oneOf:
- type: number
minimum: 0
maximum: 1
- type: 'null'
max_completion_tokens:
oneOf:
- type: integer
minimum: 1
- type: 'null'
response_format:
oneOf:
- $ref: '#/components/schemas/ChatResponseFormatText'
- $ref: '#/components/schemas/ChatResponseFormatJsonSchema'
reasoning_effort:
oneOf:
- type: string
enum:
- none
- minimal
- low
- medium
- high
- xhigh
- type: 'null'
n:
type: integer
enum:
- 1
description: Only n=1 is currently supported.
modalities:
type: array
minItems: 1
maxItems: 1
items:
type: string
enum:
- text
stream:
type: boolean
description: When true, the response is returned as a Server-Sent Events stream of chat.completion.chunk objects instead of a single JSON response.
stream_options:
type: object
description: Options that apply when stream is true.
properties:
include_usage:
type: boolean
description: When true, emit a final chunk with token usage for the full request before the [DONE] terminator.
additionalProperties: false
store:
type: boolean
enum:
- true
description: Only true is supported.
user:
type: string
maxLength: 256
metadata:
$ref: '#/components/schemas/RequestMetadata'
additionalProperties: true
ChatCompletionMessage:
type: object
required:
- role
properties:
role:
type: string
enum:
- system
- user
- assistant
- tool
- function
- developer
content:
oneOf:
- type: string
- type: 'null'
- type: array
items:
oneOf:
- $ref: '#/components/schemas/ChatTextContentPart'
- $ref: '#/components/schemas/ChatImageContentPart'
name:
type: string
tool_calls:
type: array
items:
type: object
additionalProperties: true
tool_call_id:
type: string
function_call:
type: object
additionalProperties: true
additionalProperties: false
ChatCompletionResponseMessage:
type: object
required:
- role
- content
properties:
role:
type: string
enum:
- assistant
content:
oneOf:
- type: string
- type: 'null'
reasoning_content:
oneOf:
- type: string
- type: 'null'
refusal:
oneOf:
- type: string
- type: 'null'
additionalProperties: true
ChatCompletionChunkDelta:
type: object
properties:
role:
type: string
content:
type: string
reasoning_content:
type: string
refusal:
type: string
tool_calls:
type: array
items:
$ref: '#/components/schemas/ChatCompletionChunkToolCall'
additionalProperties: false
ChatCompletionChunk:
type: object
description: 'One Server-Sent Events chunk emitted when stream: true. The streamed response is a sequence of these chat.completion.chunk objects, each sent as an SSE data: line and terminated by a final data: [DONE] line.'
required:
- id
- object
- created
- model
- choices
properties:
id:
type: string
object:
type: string
enum:
- chat.completion.chunk
created:
type: integer
model:
type: string
choices:
type: array
items:
$ref: '#/components/schemas/ChatCompletionChunkChoice'
usage:
$ref: '#/components/schemas/ChatCompletionUsage'
additionalProperties: false
ChatCompletionUsage:
type: object
required:
- prompt_tokens
- completion_tokens
- total_tokens
properties:
prompt_tokens:
type: integer
completion_tokens:
type: integer
total_tokens:
type: integer
prompt_tokens_details:
type: object
additionalProperties: true
completion_tokens_details:
type: object
additionalProperties: true
additionalProperties: false
ChatCompletionResponse:
type: object
required:
- id
- object
- created
- model
- choices
properties:
id:
type: string
object:
type: string
enum:
- chat.completion
created:
type: integer
model:
type: string
choices:
type: array
minItems: 1
items:
$ref: '#/components/schemas/ChatCompletionChoice'
usage:
$ref: '#/components/schemas/ChatCompletionUsage'
additionalProperties: true
ChatCompletionChunkChoice:
type: object
required:
- index
- delta
properties:
index:
type: integer
delta:
$ref: '#/components/schemas/ChatCompletionChunkDelta'
logprobs:
type: 'null'
finish_reason:
type:
- string
- 'null'
enum:
- stop
- tool_calls
- null
additionalProperties: false
ChatResponseFormatJsonSchema:
type: object
required:
- type
- json_schema
properties:
type:
type: string
enum:
- json_schema
json_schema:
type: object
required:
- name
properties:
name:
type: string
description:
type: string
schema:
type: object
additionalProperties: true
strict:
type: boolean
additionalProperties: false
additionalProperties: false
parameters:
IdempotencyKey:
name: Idempotency-Key
in: header
required: false
schema:
type: string
maxLength: 255
description: Makes the request retry-safe. Sail stores a reservation keyed by (organization, API key, Idempotency-Key); retrying with the same value returns the previously stored response instead of re-running inference. Keys are capped at 255 characters. See [Idempotent Requests](/idempotency) for full semantics.
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: API Key