Chat completions
Supported text parameters, response usage and server-sent events.
Live system status and incident history →
POST /v1/chat/completions
Send a model ID and 1–1,000 messages. Each message uses role system, developer, user or assistant, string content, and an optional name of up to 64 characters. Only text and n=1 are supported. Unknown fields, tools, images and other multimodal inputs are rejected. The body limit is 1 MiB.
curl 'https://api.xoomcloud.si/v1/chat/completions' \
-H "Authorization: Bearer $XOOMCLOUD_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "meta-llama/Llama-3.3-70B-Instruct",
"messages": [
{
"role": "user",
"content": "Hello, XoomCloud!"
}
],
"max_tokens": 64
}'Supported parameters
Provider support for sampling controls may vary. The gateway validates the following fields; seed is not a determinism guarantee.
| Parameter | Accepted value / behavior |
|---|---|
| model / messages | Required model ID and text messages; message content up to 1,000,000 characters. |
| max_tokens / max_completion_tokens | Integer 1–1,000,000; max_completion_tokens takes precedence. Clamped to catalog maxOutputTokens; default min(256, maxOutputTokens). |
| temperature / top_p | 0–2 / 0–1. |
| stop | Nonempty string up to 200 characters or an array of up to four such strings. |
| presence_penalty / frequency_penalty | Each -2 to 2. |
| seed / user | Integer seed; user string up to 200 characters. |
| n | Only 1 (default). |
| stream / stream_options | Boolean stream (default false); optional {include_usage: true}. |
Context and output limits
The shared tokenizer checks input plus clamped output against model contextLength. Oversized requests return 400 context_length_exceeded. Output clamping does not trim the prompt. Choose a smaller output cap or shorten the messages.
Streaming with SSE
Set stream:true. Consume data frames until data: [DONE]. Content arrives as choices[0].delta.content; handle empty deltas. With stream_options.include_usage:true, the final usage chunk has empty choices and token usage. Without it, that final usage chunk is omitted.
An error after streaming begins appears as an error frame followed by [DONE]; HTTP 200 alone does not prove success. No provider retry occurs after bytes have been emitted. Disconnects cancel generation, with partial generated output still metered. Streaming cost appears later in usage/logs, not in a final HTTP cost header.
curl -N 'https://api.xoomcloud.si/v1/chat/completions' \
-H "Authorization: Bearer $XOOMCLOUD_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "meta-llama/Llama-3.3-70B-Instruct",
"messages": [
{
"role": "user",
"content": "Hello, XoomCloud!"
}
],
"max_tokens": 64,
"stream": true,
"stream_options": {
"include_usage": true
}
}'Response metadata
Full responses use the OpenAI chat completion shape with choices and usage. Read x-request-id for support, x-xc-model and x-xc-provider for routing metadata, and x-xc-cost-micros for non-streaming request cost.