Skip to main content
POST
Chat Completions API

Authorizations

Authorization
string
header
required

API key authentication. Pass your API key as a Bearer token.

Headers

X-Opper-Name
string

Function name for tracing and project-level guardrail function-scope filtering.

X-Opper-Parent-Span-Id
string<uuid>

Parent span ID for distributed tracing context.

X-Opper-Tags
string

Comma-separated key:value usage-attribution tags (e.g. tenant:acme,project:demo, max 8). Recorded on the generation's billing/metrics rows; group spend by any key via GET /v2/analytics/usage?group_by=. Header-borne twin of the /v3/session URL prefix tags (which win per key when both are present); opper.-prefixed keys and session_id are reserved. Malformed values return 400.

Body

application/json
messages
object[]
required
cache_control
object

Opt in to automatic prompt caching for Anthropic-family models: {"type":"ephemeral"} (optionally "ttl":"1h"). Places one moving cache breakpoint on the largest cacheable prefix. Also settable per content part for precise placement. Caching is off unless set; no-op on providers with automatic server-side caching (OpenAI

custom_model_credentials
object
max_completion_tokens
integer
max_tokens
integer
metadata
object
model
string
output_schema
object
reasoning_effort
string
response_format
object
stop
string[]
stream
boolean
stream_options
object
temperature
number
tool_choice
any

Any value

tools
object[]
top_p
number

Response

Successful response

choices
object[]
required
created
integer
required
id
string
required
model
string
required
object
string
required
usage
object
required
cost
number
meta
object