stream to true to receive
incremental server-sent events. Replace the example model with one available to your project:
Client behavior
- Set a connection timeout separately from the total streaming timeout.
- Process complete SSE events rather than assuming each network chunk is one event.
- Treat provider error events and non-2xx HTTP responses as distinct failure paths.
- Stop reading and close the connection when the end user cancels generation.
- Record your
X-Request-IDso an individual stream can be correlated with gateway telemetry.
Usage can arrive near the end of a provider stream. Do not estimate final billing solely from
partial output observed by the client. Review pricing and cost attribution
for final-usage settings, partial accounting, and hard-budget settlement.