Streaming LLM answers from FastAPI with SSE: sources first, then tokens
An SSE endpoint sent sources after 52 ms instead of a 1,664 ms JSON wait. One blocking time.sleep in the generator pushed first byte to 3,280 ms with 5 clients.
23 Oct 2026 · fastapi · streaming