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.

Body

application/json
messages
object[]
required
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 thread id. Present = opt into server-side thread replay/append (Memory service); a client-chosen, organization-scoped string.

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
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