Engrain by ByteRush

AIF.01.01 Mid-levelCore — asked often

How LLM streaming works on the wire

Comes up in: Frontend system design, AI system design, Web fundamentals

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • server-sent events format
  • streaming event types in LLM APIs (message start, content block deltas, tool-use input deltas, stop reasons — using the Claude Messages API as the worked example)
  • why a backend proxy is needed (never expose API keys)
  • proxying streams through a Worker/Next route

Words you will know

token streamdeltastop reasonstreaming proxy

What you will practise

  • build a streaming proxy endpoint (mock provider in CI)

Interview questions this answers

  • How would you stream an LLM response into a React UI?
  • Why should the browser not call the LLM provider directly?
  • How do you handle a stream that fails halfway?