AI engineering

Stage 2 · Lesson 6 of 9

Streaming responses

Prompting and model APIs

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

Practise

  • Run open models locally to test prompts and sampling settings at zero API cost

Keep handy

Also worth your time

Mark this stage as not done?