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

# Stream a chat completion

`POST /v1/chat/completions`

## Request

- Base URL: `https://api.dotwave.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.dotwave.ai/v1/chat/completions`
- Auth: none declared

Generate text or tool calls using a project API key. Access follows the project's agreed service hours. Responses stream as server-sent events. Reuse X-Session-Affinity for each conversation; an unavailable assigned service returns an error without fallback.

## Headers

- `authorization` string, nullable: `Bearer wk_…`: the project's API key (`Token` is an alias of `Bearer`). Create API keys in the console. New accounts start with $10 of credit; no card required.
- `x-api-key` string, nullable: The same API key, in place of the Authorization header.
- `X-Session-Affinity` string, nullable: Optional opaque conversation ID (1–256 ASCII letters, digits, period, underscore, colon or hyphen). Reuse across every turn and tool continuation. Assignments are project scoped and expire after 24 hours of inactivity.

## Request body

- object
  - `max_tokens` integer
  - `messages` object[], required
  - `model` 'gemma4-bf16', required
  - `stream` true, required
  - `stream_options` object, nullable
  - `tool_choice` union
    - string
    - object
  - `tools` object[], nullable

## Response `200`

Successful Response

## Other responses

- `400`: Invalid request
- `401`: Invalid API key
- `403`: Model access is disabled or outside service hours
- `422`: Validation Error
- `429`: Service is busy
- `502`: Generation failed
- `503`: Service is unavailable
- `504`: Generation timed out

---

[API](https://skmtc.dev/dotwave/apis/wave-live-api.md) - [All operations](https://skmtc.dev/dotwave/apis/wave-live-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dotwave/apis/wave-live-api/revisions/57e80b62c850?raw)
