v1

latestOpenAPI 3.0.02026-07-262088144.5 KB
Chat Completions

Create chat completion

post/v1/chat/completions

Request body

modelstring required

The model to use, which can be:

  • A model id (e.g., gpt-oss-120b). The best provider is automatically selected by latency, or you can control provider selection via extra_body.provider. See Models for available models.
  • A provider-prefixed model id (e.g., openai/gpt-5). This specifies the provider and model to use.
  • auto for automatic model selection based on criteria like price, latency, or intelligence
  • A router, which is specified by inworld/<router-name>. The router name must be prefixed by inworld/.
streamboolean

If true, partial message deltas will be sent as server-sent events.

temperaturenumber

Sampling temperature between 0 and 2. Higher values make output more random.

top_pnumber

Nucleus sampling parameter. Must be greater than 0.

max_tokensinteger

Maximum number of tokens to generate.

max_completion_tokensinteger

Maximum number of completion tokens to generate.

presence_penaltynumber

Penalizes tokens based on presence in the text.

frequency_penaltynumber

Penalizes tokens based on frequency in the text.

seedinteger

Random seed for generation.

stopstring[]

Up to 4 sequences where the API will stop generating.

reasoning_effort'none' | 'low' | 'minimal' | 'medium' | 'high' | 'xhigh'

Controls the amount of reasoning effort the model uses. Note: This parameter is provider/model-specific and may not be supported by all models (e.g., OpenAI models do not support this parameter). This will be overridden if extra_body.reasoning is specified.

userstring

A unique identifier for the end user. When used with a router, the same user will consistently receive the same variant across requests (sticky routing).

modalitiesstring[]

Output modalities to generate. Defaults to ["text"]. Include "image" to request image generation (e.g., ["text", "image"]). Currently supported for OpenAI and Google image models.

Response

A successful response. Returns either a complete chat completion or streaming chunks.

idstring

Unique identifier for the chat completion.

objectstring

Object type, always 'chat.completion'.

createdinteger

Unix timestamp when the completion was created.

modelstring

The model that was actually used.