Chat Completions API
The primary endpoint of the Setu gateway. Generates conversational responses, answers questions, executes Model Context Protocol (MCP) function tools, and outputs step-by-step reasoning traces.
Endpoint
POST https://supremeai.services/api/setu/v1/chat/completionsRequest Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer sup_live_... or sup_test_... API key |
Content-Type | string | Yes | application/json |
X-Supreme-Signature | string | No | HMAC-SHA256 signature for secured webhook dispatchers |
Request Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Target Quantum model (quantum-lite, quantum-flash, quantum-reasoner, quantum-pro). |
messages | array | Yes | — | Array of message objects with role (system, user, assistant, tool) and content. |
stream | boolean | No | false | If true, returns partial token deltas via Server-Sent Events (SSE). |
temperature | number | No | 0.7 | Sampling temperature between 0.0 (deterministic) and 2.0 (creative). |
max_tokens | integer | No | 4096 | Upper token generation ceiling (max 8192). |
tools | array | No | null | Array of MCP or function tool definitions that the model may invoke. |
tool_choice | string / object | No | 'auto' | Controls whether the model must invoke a specific tool or decide autonomously. |
Response Formats
Non-Streaming Response (200 OK)
{
"id": "chatcmpl-setu-91a3f01b",
"object": "chat.completion",
"created": 1728259200,
"model": "quantum-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "नमस्ते! म तपाईंलाई कसरी सहयोग गर्न सक्छु?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 12,
"total_tokens": 26
}
}Reasoning Traces (quantum-reasoner)
When invoking quantum-reasoner, the model generates a dynamic test-time compute chain of thought before emitting the final answer. In the response, the thought trace is encapsulated within message.reasoning_content:
{
"id": "chatcmpl-setu-reason-482a",
"object": "chat.completion",
"model": "quantum-reasoner",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"reasoning_content": "1. Analyze adiabatic expansion relation P*V^gamma = C.\n2. Express boundary work as integral of P dV.\n3. Integrate from V1 to V2 to obtain (P2*V2 - P1*V1)/(1 - gamma).",
"content": "The work done during a reversible adiabatic expansion is given by W = (P2*V2 - P1*V1) / (1 - γ)."
},
"finish_reason": "stop"
}
]
}During streaming (stream: true), reasoning tokens are emitted via custom thought_trace SSE events:
event: thought_trace
data: {"delta": "Analyzing adiabatic boundary work integral..."}
event: message
data: {"id":"chatcmpl-setu-1","choices":[{"delta":{"content":"The work done..."}}]}
data: [DONE]Model Context Protocol (MCP) Tool Calling
Setu supports standard function definitions. When the model selects a tool, it emits a tool_calls array containing typed JSON arguments:
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_mcp_neon_01",
"type": "function",
"function": {
"name": "neon_run_sql",
"arguments": "{\"query\":\"SELECT customer_name, total_npr FROM invoices WHERE status = 'UNPAID' LIMIT 5;\"}"
}
}
]
}Interactive API Specification
Test and review schema definitions directly from our OpenAPI 3.1 specification.
Headers
Request Body Parameters
Target model ID. Options: quantum-lite, quantum-flash, quantum-reasoner, quantum-pro.
Conversation messages array with role ("system" | "user" | "assistant") and content string.
If true, streams partial delta tokens via Server-Sent Events (text/event-stream).
Sampling temperature between 0.0 and 2.0.
curl -X POST https://supremeai.services/api/setu/v1/chat/completions \
-H "Authorization: Bearer $SUPREME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "quantum-lite",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Hello!" }
],
"temperature": 0.7,
"max_tokens": 4096
}'Successful completion. Returns standard OpenAI completion envelope.
{
"id": "chatcmpl-setu-91a3f01b",
"object": "chat.completion",
"created": 1728259200,
"model": "quantum-lite",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Namaste! How can I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 15,
"completion_tokens": 12,
"total_tokens": 27
}
}