Skip to content

Create a chat completion (OpenAI-compatible)

POST
/oai/v1/chat/completions
curl --request POST \
--url https://dashboard.quantcdn.io/oai/v1/chat/completions \
--header 'Content-Type: application/json' \
--data '{ "model": "anthropic.claude-sonnet-4-6", "messages": [ { "role": "system", "content": "example" } ], "stream": false, "max_tokens": 1, "temperature": 1, "top_p": 1, "tools": [ {} ], "tool_choice": "example", "stream_options": {} }'

Drop-in replacement for OpenAI’s POST /v1/chat/completions. Point any OpenAI SDK at base_url=https:///oai/v1 and use a Quant API token (qc_…) as the api_key. Set stream: true to receive Server-Sent Events (chat.completion.chunk objects terminated by data: [DONE]); otherwise a single chat.completion object is returned. Supports tool/function calling and the standard tool_choice modes.

Media typeapplication/json
object
model
required

A model id from GET /oai/v1/models

string
Example
anthropic.claude-sonnet-4-6
messages
required
Array<object>
object
role
string
Allowed values: system user assistant tool
content
string
stream

Stream the response as SSE chat.completion.chunk events

boolean
max_tokens
integer
temperature
number
top_p
number
tools

OpenAI function tool definitions

Array<object>
object
tool_choice

Auto | none | required | {type:function, function:{name}}

stream_options

{include_usage: true} to emit a final usage chunk when streaming

object

A chat.completion object (or an SSE stream of chat.completion.chunk objects when stream=true)

Media typeapplication/json
object
id
string
object
string
created
integer
model
string
choices
Array<object>
object
index
integer
message
object
role
string
content
string
nullable
tool_calls
Array<object>
object
finish_reason
string
Allowed values: stop tool_calls length
usage
object
prompt_tokens
integer
completion_tokens
integer
total_tokens
integer
Example
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"choices": [
{
"finish_reason": "stop"
}
]
}

Missing or invalid API key

Token not scoped to an organisation, or org lacks AI access

Invalid request