Skip to content

Chat Completions

The main way to generate text: chat, Q&A, summarization, tool calling and vision all go through this endpoint.

POST/v1/chat/completions

Request parameters

FieldTypeRequiredDescription
modelstringModel name (e.g. verinova)
messagesarrayChat messages (see below)
streambooleanIf true, returns an SSE stream
stream_optionsobject{ "include_usage": true } for token info in a stream
max_tokensintegerMax tokens to generate
max_completion_tokensintegerNew name for max_tokens
temperaturenumberCreativity (0–2). Lower = more consistent
top_pnumberNucleus sampling
toolsarrayFunctions the model may call
tool_choicestring/objectTool selection behavior
response_formatobject{ "type": "json_object" } or json_schema
stopstring/arrayStop sequences
frequency_penalty / presence_penaltynumberRepetition penalties
seednumberFor reproducibility
userstringEnd-user identifier

messages item

FieldTypeDescription
rolestringsystem, user or assistant
contentstring | arrayPlain text or multi-part content (text + image)
tool_callsarray(assistant) Tool calls requested by the model
tool_call_idstring(tool) Which tool call this responds to

Basic example

bash
curl https://app.qevron.ai/v1/chat/completions \
  -H "Authorization: Bearer $QEVRON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "verinova",
    "messages": [
      { "role": "system", "content": "You are a helpful assistant." },
      { "role": "user", "content": "How do I reverse a list in Python?" }
    ]
  }'
python
resp = client.chat.completions.create(
    model="verinova",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "How do I reverse a list in Python?"},
    ],
)
print(resp.choices[0].message.content)
javascript
const resp = await client.chat.completions.create({
  model: "verinova",
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "How do I reverse a list in Python?" },
  ],
});
console.log(resp.choices[0].message.content);

Response

json
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1716200000,
  "model": "verinova",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Use list.reverse() in place, or list[::-1] for a new list..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 31, "completion_tokens": 42, "total_tokens": 73 }
}
FieldDescription
choices[].message.contentGenerated reply text
choices[].finish_reasonstop, length, tool_calls, content_filter
usageToken usage

Streaming

Add "stream": true; the response arrives as SSE chunks. Details: Streaming.

Vision

On vision-capable models (e.g. spook-vision) send content as multi-part:

json
{
  "model": "spook-vision",
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "What's in this image?" },
        { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64,..." } }
      ]
    }
  ]
}

image_url.url can be a public URL or a data: base64. Full guide: Vision.

Tool calling

json
{
  "model": "verinova",
  "messages": [{ "role": "user", "content": "What's the weather in Istanbul?" }],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the weather for a city",
        "parameters": {
          "type": "object",
          "properties": { "city": { "type": "string" } },
          "required": ["city"]
        }
      }
    }
  ]
}

If the model wants to call a tool, the response's choices[0].message.tool_calls is populated; you run the function and send the result back as a role: "tool" message.

JSON output

json
"response_format": { "type": "json_object" }

or to enforce a schema:

json
"response_format": {
  "type": "json_schema",
  "json_schema": { "name": "person", "schema": { "type": "object", "properties": { "name": {"type":"string"} } } }
}

Qevron — AI gateway. Arpanet / OpenAI / Anthropic / Gemini compatible.