---
title: "Stream a chat completion."
method: POST
path: "/v1/ai/chat/completions/stream"
tags: ["AI"]
---

# Stream a chat completion.

`POST /v1/ai/chat/completions/stream`

## Request

- Base URL: `https://api.scalix.world`
- URL: `https://api.scalix.world/v1/ai/chat/completions/stream`
- Auth: HTTP bearer

Runs an OpenAI-compatible chat completion and streams the response as server-sent events.

## Request body

- ChatCompletionRequest: A chat-completion request (OpenAI-compatible). Streams via SSE when `stream`.
  - `messages` ChatMessage[], required
    - `role` string, required: One of `system`, `user`, `assistant`.
    - `content` string, required
  - `model` string, required
  - `max_tokens` integer, nullable
  - `temperature` number, double, nullable
  - `top_p` number, double, nullable
  - `stream` boolean, nullable

## Response `200`

Server-sent event stream of completion chunks

## Other responses

- `401`: Missing or invalid API key
- `402`: Budget exhausted
- `500`: Internal error
- `503`: All providers exhausted

---

[API](https://skmtc.dev/scalix/apis/scalix-cloud-api.md) · [All operations](https://skmtc.dev/scalix/apis/scalix-cloud-api/llms.txt) · [OpenAPI document](https://skmtc.dev/scalix/apis/scalix-cloud-api/revisions/2c04ca0a90bb?raw)
