OpenAI Compatible

OpenAI-compatible chat completions with policy enforcement

Accepts a standard OpenAI Chat Completions request, decides it with the ADR-065 decision plane (PRD v11 §1.1; #4092) - the shared policy engine's detectors are its input - forwards an allowed request to the upstream provider, records audit (tokens, cost, latency, policy decision), and returns an OpenAI-compatible response.

The route carries no per-user identity, so every request is decided for its client credential (Client). OpenAI's user request member is NOT honoured as an identity: it is free text the caller chooses, and a principal is never taken from it.

The caller passes their upstream provider API key via the X-Provider-Key header. AxonFlow auth (Basic Auth or community mode) is handled by the same apiAuthMiddleware as all other agent endpoints.

Streaming (stream: true) is not supported in this release and returns HTTP 400 with a clear error.

post/v1/chat/completions

Request

Headers

X-Provider-Keystring required

Upstream LLM provider API key (e.g. OpenAI API key)

traceparentstring

W3C traceparent header for trace correlation

Request body

modelstring required

ID of the model to use (e.g. gpt-4o, gpt-4o-mini).

temperaturenumber
top_pnumber
max_tokensinteger
max_completion_tokensinteger
streamboolean

Must be false or omitted. Streaming is not supported in this release; setting stream=true returns HTTP 400.

stopunknown
presence_penaltynumber
frequency_penaltynumber
userstring
response_formatobject
seedinteger
toolsobject[]
tool_choiceunknown

Example request

{
  "model": "gpt-4o"
}

Response

Successful completion

idstring required

Unique identifier for the completion.

object'chat.completion' required
createdinteger required

Unix timestamp of creation.

modelstring required

Model used for the completion.

system_fingerprintstring

Example response

{
  "id": "chatcmpl-abc123"
}

Changes

No recorded changes to this operation across all 1 revision of this API.