Stage 2 · Lesson 6 of 9
Streaming responses
A long reply can take 10 seconds or more to finish, but the first token often arrives in under a second. Streaming sends tokens to the user as they are written, usually over (a simple way for a server to keep pushing updates to a browser).
Users read while the model writes, so the feature feels fast. It changes your code. You get a series of small instead of one response, and you join the text together yourself.
Token usage arrives in the final event, and errors can arrive halfway through. is harder to use mid-stream, because half-finished does not parse. Measure and total time separately, since users feel them differently.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Prompt Engineering for Software Engineers
Design Gurus · Beginner · Subscription
Prompting patterns for engineers building features, not for chatting
- ToolFreeVercel AI SDK Documentation
Vercel · Intermediate
Free: the Foundations and Getting Started guides for prompts, generateText and streamText
Practise
Keep handy
Also worth your time
Few-shot, chain of thought, JSON enforcement and parsing failures in one place