Skip to main content
Set "stream": true to receive the response incrementally as server-sent events (SSE), rather than waiting for the full completion. Streaming uses the same /v1/chat/completions endpoint and is fully OpenAI-compatible, so any OpenAI SDK handles it for you.

Streaming a response

The event format

Each event is a data: line containing a chunk in OpenAI’s streaming shape (object: "chat.completion.chunk"). Instead of a full message, each choice carries a delta with the incremental piece. The stream terminates with a literal data: [DONE] line:
Concatenate every choices[0].delta.content to reconstruct the full text. The final content-bearing chunk includes a finish_reason.

Usage on streamed requests

By default, streamed responses don’t include a usage object. Set stream_options: {"include_usage": true} to receive one final chunk carrying the authoritative token counts, so you don’t have to count tokens yourself.
The usage chunk comes just before data: [DONE] and has an empty choices array:

Billing and cancellation

Billing counts tokens actually produced, including partial output. If your client disconnects or cancels mid-stream, Omnia settles the tokens generated up to that point. You’re charged for what was produced, not the whole request, and never for nothing.
This matters for agents and UIs that stop generation early (for example, when a user navigates away). Cancelling saves you the tokens you would have received after the cancel point, but the tokens already streamed are billed.

When to stream

Stream when you’re rendering output to a user in real time (chat UIs, agents) so they see progress immediately. For batch jobs where you only need the final text, a non-streaming request is simpler to consume.