Skip to main content
POST
Handle an OpenAI Chat Completions-compatible request, streaming or returning the assembled response

Authorizations

Authorization
string
header
required

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

Body

application/json

Validates POST /v1/chat/completions (OpenAI-compat) per ADR-YGE00M.

Accepts OpenAI's Chat Completions wire format: system/user/assistant/tool role messages, function-tool definitions, and tool_calls/tool_call_id for round-tripping tool results. top_p, tool_choice, and stop are wired into InferenceRequest's canonical topP/toolChoice/stopSequences fields (HASP-509); user is forwarded as metadata.user_id, a documented graceful degrade on this surface (see DirectProviderDriver::supports()) — OpenAI's real API accepts it but HASP's OpenAI driver does not forward it upstream today. n, frequency_penalty, and presence_penalty are outside the cross-provider parameter model this DTO carries (no Anthropic analog) and remain validated for shape but otherwise ignored.

model
string
required
Maximum string length: 100
messages
object[]
required
Minimum array length: 1
tool_choice
string | null
max_tokens
integer | null
Required range: 1 <= x <= 32000
stream
boolean | null
temperature
number | null
Required range: 0 <= x <= 2
top_p
number | null
Required range: 0 <= x <= 1
n
integer | null
frequency_penalty
number | null
Required range: -2 <= x <= 2
presence_penalty
number | null
Required range: -2 <= x <= 2
user
string | null
Maximum string length: 255
provider_extensions
string[] | null

Escape hatch for provider-specific wire keys the canonical fields above don't (yet) model — see ADR-ZP99PX. No OpenAI driver wiring exists today (see DirectProviderDriver::supports()), so setting this is rejected with UNSUPPORTED_PARAMETER rather than silently dropped.

stop
string[] | null
tools
object[] | null

Response

id
string
required
object
string
required
Allowed value: "chat.completion"
created
integer
required
model
any
required
choices
tuple
required
usage
object
required