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. Your client always learns the turn failed.
- Treat a mid-stream error like a
5xx: retry the whole request with backoff (Errors). - 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.