One flag, three dialects
Raw SSE with curl (-N disables buffering)
SDK examples
Usage on streams
On Chat Completions, request the final usage totals withstream_options:
[DONE] then carries usage. On Messages, usage arrives natively
in message_delta. Set { "include_usage": false } if a strict client chokes on the extra
chunk.
Failure semantics
- A stream that cannot complete ends with a protocol-shaped error event — never a
silent empty 200. On the OpenAI dialect that means an in-band error frame and no
data: [DONE], which is sent only on clean completion; on Messages theerrorevent replacesmessage_stop. Your client always learns the turn failed. - Once output has started, Sideren never replays or splices the stream — the model may already have emitted tool calls your client acted on. Whether to send the turn again is your client’s decision; if you do, retry the whole request with backoff (Errors).
- While a request waits for capacity before its first token, the stream carries SSE keepalive comments (every 15 seconds) so idle timeouts don’t fire. Clients ignore them.
- Long gaps between tokens are normal on reasoning models — they spend time thinking before emitting text. Don’t set aggressive idle timeouts on the read side.
Streaming and non-streaming requests draw from the same plan meter and rate limits —
there is no reason not to stream interactive traffic.