v2
latestOpenAPI 3.1.02026-08-05267431678.1 KBChat Completions
OpenAI-compatible chat completions endpoint.
Thin shell over :func:services.inference.adapters.openai_chat.run_chat_completion. The adapter handles LLM-passthrough vs Pioneer-task dispatch, SSE rendering with <think>...</think> folding for reasoning models, tool-call deltas, finish-reason mapping, persistence, and error mapping. The router keeps only HTTP-shaped concerns: route declaration, auth, rate limiting.
Args: body: Validated :class:ChatCompletionRequest. request: FastAPI request (forwarded so the adapter can read API-key billing context out of request.state for streaming responses). auth: Authenticated request context.
Returns: :class:ChatCompletionResponse for non-streaming, or a :class:StreamingResponse of chat.completion.chunk SSE events terminated by data: [DONE] when body.stream is true.
Request body
Response
Chat completion. Returns application/json (ChatCompletionResponse) by default, or text/event-stream of ChatCompletionStreamChunk events terminated by data: [DONE] when stream=true.