Skip to main content
POST
Create a chat completion

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Idempotency-Key
string

Your own id for this request, which becomes the platform's request id. A retry carrying the same key is matched to the first request's usage record rather than billed again, so make it unique per request. A generated uuid is used when absent.

X-Title
string

The application making this request, shown and filtered on in the trace explorer. The same string on every request a deployment sends, so an SDK sets it once. Up to 120 characters; a longer value is ignored rather than cut.

Maximum string length: 120
traceparent
string

Your own W3C trace context. The trace id and the incoming span id are recorded on the trace so it can be lined up with the same request in your APM. A value that cannot be parsed is ignored rather than rejected.

Body

application/json
messages
object[]
required

The per-file caps below bound one attachment. This bounds the body they arrive in, which is the number a provider actually enforces.

Minimum array length: 1
model
string

Exactly one of model / models is required: a single model slug, or an ordered chain of slugs/aliases to try in turn (see RouteIntent and RoutePlanner). prohibits:models on model is what turns sending both into a 422 rather than models silently winning.

models
string[]
Minimum array length: 1
provider
object

The provider preferences object (OpenRouter-parity routing controls). Every field may only narrow what workspace policy already permits; see App\Services\Inference\Data\ProviderPreferences.

temperature
number | null
max_tokens
integer | null
Required range: x >= 1
stream
boolean | null
stream_options
object

OpenAI's opt-in for a trailing usage-only chunk on streamed responses. Usage is always attached to the finish chunk regardless (see RunChatCompletion::streamResponse()); this only controls the additional empty-choices frame emitted after it.

firewall
boolean | null

Defaults true. Set false to opt out of the firewall and accept non-EU routing; honoured only when the organization has recorded a compliance acceptance, otherwise the egress guard refuses the call.

firewall_language
enum<string> | null

The language the firewall analyses this request as, overriding the workspace's setting for this call only. auto detects per message. A caller sending several languages needs this per call rather than a workspace each; one that always sends the same language should set it on the workspace and omit it here.

Available options:
auto,
nl,
en,
fr,
de
collection
string[] | null

Narrows retrieval to named knowledge collections. Omit it (the default) to blend the whole workspace: personal memory, the workspace's shared knowledge, and every collection in it. Pass a collection slug, or a list of slugs, to read only those plus the caller's own personal memory. A slug the workspace does not have is rejected, never ignored.

Maximum string length: 255
user
string | null

Optional end-user id (OpenAI's user). Scopes long-term memory facts.

Maximum string length: 255
thread
string | null

Optional conversation id, chosen by the caller. Groups this call with every other call that sends the same one on its trace; it changes nothing about how the request is served.

Maximum string length: 255
tags
string[] | null

Free-form labels recorded on the trace, at most ten of at most 64 characters each. They do not change how the request is served: they make the trace explorer able to answer questions about it afterwards.

Maximum array length: 10
Maximum string length: 64
name
string | null

A human label for this request, shown on its trace.

Maximum string length: 120
top_p
number | null
Required range: 0 <= x <= 1
stop
string[] | null

stop accepts a bare string or an array of strings; stop.* validates array elements when an array is supplied but does not apply to a scalar.

presence_penalty
number | null
Required range: -2 <= x <= 2
frequency_penalty
number | null
Required range: -2 <= x <= 2
n
integer | null
Required range: x >= 1
seed
integer | null
logit_bias
number[] | null
Required range: -100 <= x <= 100
logprobs
boolean | null
top_logprobs
integer | null
Required range: 0 <= x <= 20
max_completion_tokens
integer | null
Required range: x >= 1
tools
object[] | null
tool_choice
string | null

tool_choice may be a string ('none'|'auto'|'required') OR an object ({type:'function',function:{name}}); the controller normalises it downstream.

parallel_tool_calls
boolean | null
reasoning_effort
enum<string> | null

How hard a reasoning model thinks. A level the model does not take is refused in strict mode and dropped otherwise.

Available options:
high,
low,
max,
medium,
minimal,
none,
xhigh,
null
cache
boolean | null

Set false to bypass the response cache for this request even when the Cache service is enabled and the request would otherwise be cacheable. Defaults true (cache enabled when service is on).

response_format
object

Response

id
string
required
object
string
required
Allowed value: "chat.completion"
created
integer
required
model
string
required
choices
object[]
required
usage
object
required
sources
object[]
required