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/completionsBase URL https://capi.aiAPI version v1Authentication Bearer YOUR_API_TOKEN
02Parameters
| Name | Type | Description |
|---|---|---|
| model* | string | Model ID, e.g. gpt-5.6 or claude-opus-5. |
| messages* | array | Conversation history in OpenAI message format. |
| stream | boolean | Stream tokens as server-sent events. |
| temperature | number | Sampling temperature between 0 and 2. |
| tools | array | Tool 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 }
}