Create a chat completion
Send a conversation and get a reply. Set stream to true for server-sent events. A request can fail over to another endpoint only before the first content token; after that the stream ends with a terminal frame instead.
bearerAuthAuthorizationBearer <token>Your API key, sent as Authorization: Bearer <key>.
Idempotency-Key?stringAny string you choose. A retry with the same key and body returns the first result instead of running again. The same key with a different body is a 409 idempotency_conflict.
x-op-metadata?"enabled"Set to enabled to receive op_metadata (cost, retention class, region, policy notes) with the response.
"enabled"application/json- body
model*stringThe model id, in author/slug form.
models?array<string>Fallback models, tried in order if the first cannot serve. Only with this list may another model answer.
items <= 5messages*array<>stream?booleanfalsemax_tokens?integermax_completion_tokens?integertemperature?numbertools?array<>OpenAI tool definitions.
response_format?{"type": "json_object"} or {"type": "json_schema", ...} as in the OpenAI API.
provider?How the request is routed. Each option can only narrow it.
op?The reply. JSON when stream is false, server-sent events when it is true.
- response
id?stringobject?stringcreated?integermodel?stringchoices?array<>usage?curl -X POST "https://example.com/v1/chat/completions" \ -H "Authorization: Bearer $OP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-oss-120b", "messages": [ { "role": "user", "content": "Say hello in one sentence." } ] }'{ "id": "string", "object": "chat.completion", "created": 0, "model": "string", "choices": [ { "index": 0, "message": {}, "finish_reason": "string" } ], "usage": { "prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0 }}