API reference

Chat Completions

POST /v1/chat/completions — parameters, responses, and multimodal input.


POST https://api.civix.com.vn/v1/chat/completions

Generates a model response for a conversation.

Request

Field Type Required Notes
model string Yes A model id from GET /v1/models.
messages array Yes Conversation so far. Roles: system, user, assistant.
stream boolean No Stream as SSE. Recommended for long prompts.
max_tokens integer No Maximum tokens to generate.
temperature number No 02. Lower is more deterministic.
top_p number No Nucleus sampling.
stop string or array No Stop sequences.
seed integer No Best-effort determinism.

Response

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1787320000,
  "model": "qwen3.8-27b",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "..." },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 118,
    "total_tokens": 142
  }
}

finish_reason is stop when the model finished naturally, or length when it hit max_tokens.

Multimodal input

Models whose capabilities include vision accept image parts alongside text:

response = client.chat.completions.create(
    model="qwen3.8-27b",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What does this diagram show?"},
            {"type": "image_url", "image_url": {"url": "https://example.com/diagram.png"}},
        ],
    }],
)

A data: URI works in place of an https URL. Check Models for which models support vision.

Long prompts

This API supports very large contexts. Two practical notes:

  1. Stream them. A non-streaming request is bounded by a server-side deadline; a streaming one is not. See Streaming.
  2. Expect a wait before the first token. A large prompt must be processed before generation begins, so time-to-first-token grows with prompt size. When streaming, the connection is kept healthy throughout.