API Reference
POST/v1/chat/completions

Chat Completions

Creates a model response for the given chat conversation. Supports both a single JSON response and an incremental SSE stream.

Request body

modelstringRequired

The model id to use, e.g. your-model-id. See Models for the full list.

messagesarrayRequired

A non-empty array of { role, content } objects describing the conversation so far.

streambooleanOptional · default false

When true, the response is sent incrementally as Server-Sent Events. See Streaming.

temperaturenumberOptional · default 0.7

Sampling temperature, clamped to the range 02.

top_pnumberOptional

Nucleus sampling probability. Passed through only if provided.

max_tokensintegerOptional

Maximum tokens to generate. Defaults to 2048 (or 4096 for reasoning models). Always capped to whatever remains of your daily token budget — see Rate Limits.

Example request

curl https://api.dravenai.lat/v1/chat/completions \
  -H "Authorization: Bearer sk-drv-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-model-id",
    "messages": [
      { "role": "system", "content": "You are a concise assistant." },
      { "role": "user", "content": "Explain what a rate limit is in one sentence." }
    ],
    "temperature": 0.7,
    "max_tokens": 300
  }'
completion = client.chat.completions.create(
    model="your-model-id",
    messages=[
        {"role": "system", "content": "You are a concise assistant."},
        {"role": "user", "content": "Explain what a rate limit is in one sentence."},
    ],
    temperature=0.7,
    max_tokens=300,
)
const completion = await client.chat.completions.create({
  model: "your-model-id",
  messages: [
    { role: "system", content: "You are a concise assistant." },
    { role: "user", content: "Explain what a rate limit is in one sentence." },
  ],
  temperature: 0.7,
  max_tokens: 300,
});

Response

Non-streaming requests return a chat.completion object:

200 OK
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1750000000,
  "model": "your-model-id",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "..." },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 27,
    "completion_tokens": 19,
    "total_tokens": 46
  }
}

finish_reason values

Moderation is a pass-through today: the system message you send is respected as-is, with no extra rules layered on top — the same way real model providers behave.

For error responses, see Errors. For stream: true, see Streaming.