Skip to main content

Chat Completions

POST /v1/chat/completions

OpenAI-compatible request and response shape. Any field the OpenAI API accepts is passed through.

Request

{
"model": "gpt-4o",
"messages": [
{ "role": "user", "content": "Summarize for me@acme.com" }
],
"stream": true
}

Request headers

HeaderRequiredDescription
AuthorizationYesBearer <api-key>
x-op-teamIf key isn't team-scopedAttributes cost to a team's budget
x-op-policyNoComma-separated policy names to apply — see Policies & Guardrails

Response

Standard OpenAI-shaped completion body, plus the x-openproxyai-* response headers documented in the API Reference Overview — cost, latency, provider, cache status, and any policy action taken.

Streaming

Set "stream": true for a server-sent-events stream of ChatCompletionChunk objects, identical in shape to OpenAI's own streaming format.

Errors

See Errors & Status Codes402 (budget), 429 (rate limit), 446 (policy block) are specific to OpenProxyAI; everything else follows standard HTTP semantics.