Chat Completions

OpenAI-compatible chat completions.

01Overview

Send OpenAI-compatible chat-completions requests through a configured OpenAI-compatible upstream. Streaming is supported when the upstream supports it.

POST/api/v1/chat/completions
Base URL https://capi.aiAPI version v1Authentication Bearer YOUR_API_TOKEN

02Parameters

NameTypeDescription
model*stringModel ID, e.g. gpt-5.6 or claude-opus-5.
messages*arrayConversation history in OpenAI message format.
streambooleanStream tokens as server-sent events.
temperaturenumberSampling temperature between 0 and 2.
toolsarrayTool definitions the model may call.

03Request body

JSON
{
  "model": "gpt-5.6",
  "messages": [
    { "role": "user", "content": "Summarise this changelog in three bullets." }
  ],
  "stream": false
}

Example

Chat Completions

curl -X POST https://capi.ai/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
HTTP 200· OK
{
  "id": "chatcmpl_9f2b41",
  "object": "chat.completion",
  "model": "gpt-5.6",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "..." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 42, "completion_tokens": 118, "total_tokens": 160 }
}