Skip to content

Chat Completions

The primary API endpoint for all Brivionix models.

Endpoint

text
POST https://brivionix.com/v1/chat/completions

Headers

http
Authorization: Bearer sk-your-api-key
Content-Type: application/json

Minimal Request

json
{
  "model": "gpt-5.4-mini",
  "messages": [
    { "role": "user", "content": "Hello!" }
  ]
}

curl Example

bash
curl https://brivionix.com/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4-mini",
    "messages": [
      {"role": "user", "content": "Briefly introduce Brivionix."}
    ]
  }'

Python Example

python
from openai import OpenAI

client = OpenAI(
    api_key="sk-your-api-key",
    base_url="https://brivionix.com/v1",
)

response = client.chat.completions.create(
    model="gpt-5.4-mini",
    messages=[
        {"role": "user", "content": "Briefly introduce Brivionix."}
    ],
)

print(response.choices[0].message.content)

Node.js Example

javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "sk-your-api-key",
  baseURL: "https://brivionix.com/v1",
});

const response = await client.chat.completions.create({
  model: "gpt-5.4-mini",
  messages: [
    { role: "user", content: "Briefly introduce Brivionix." },
  ],
});

console.log(response.choices[0].message.content);

Streaming

Add "stream": true to get real-time SSE output:

python
stream = client.chat.completions.create(
    model="gpt-5.4-mini",
    messages=[{"role": "user", "content": "Write a short poem"}],
    stream=True,
)

for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="", flush=True)

Parameters

ParameterDescription
modelModel name (see Supported Models)
messagesConversation array with system / user / assistant / tool roles
temperatureControls randomness (default: 0.7)
top_pNucleus sampling (default: 1)
frequency_penaltyReduce repeated words
presence_penaltyEncourage new topics
max_tokensMaximum output tokens
seedFor reproducible outputs
streamEnable SSE streaming
tools / tool_choiceFunction/tool calling

Vision (Image Input)

All 5 models support the Vision tag. Use the multimodal message format:

json
{
  "model": "gpt-5.4-mini",
  "messages": [{
    "role": "user",
    "content": [
      { "type": "text", "text": "Describe this image." },
      {
        "type": "image_url",
        "image_url": { "url": "https://example.com/image.jpg" }
      }
    ]
  }]
}

Response Fields

FieldDescription
idResponse ID
modelModel used
choices[].message.contentGenerated text
choices[].message.tool_callsTool calls (if any)
usage.prompt_tokensInput token count
usage.completion_tokensOutput token count

Error Handling

See API Overview — Error Codes.