Response streaming
Response streaming pipes the model's output token-by-token to the client as it's generated, so users see text appearing in real time instead of waiting for the full answer.
In more detail
What it means
Streaming is mandatory for any user-facing LLM feature in 2026 — without it the user stares at a spinner for 5-30 seconds. Every major API supports server-sent events (SSE) or websocket streaming. The engineering trade-offs: streaming complicates error handling mid-response, makes structured-output mode (JSON) harder to validate progressively, and prevents the server from inspecting the full output before sending. For tool-use loops, stream the user-facing answer but buffer tool calls until complete. Implementations typically flush tokens behind a small buffer to smooth network jitter, expose cancellation to the client, and defer persistence until the stream completes so partial failures do not leave truncated records.
Part 1 of 2
When to use it, and when not
Use it for
- Any chat or assistant UX.
- Long-form generation where users want immediate feedback.
Part 2 of 2
Common mistakes
- Streaming JSON without progressive validation — partial JSON breaks parsing.
- No abort/cancel on the client — runaway streams keep generating after the user navigates away.
FAQ
Questions readers ask.
What is response streaming?
Response streaming pipes the model's output token-by-token to the client as it's generated, so users see text appearing in real time instead of waiting for the full answer.
When should you use response streaming?
Any chat or assistant UX. Long-form generation where users want immediate feedback.
What are the common mistakes with response streaming?
Streaming JSON without progressive validation — partial JSON breaks parsing. No abort/cancel on the client — runaway streams keep generating after the user navigates away.
Last updated: 2026-09-18. Raw markdown: https://promtable.com/glossary/response-streaming.md. Found a mistake? Tell us.