80 text tokens. Shows TTFT and token rate with nothing else in the way.
Select a preset and click Send to stream
Tokens will appear here as the stream arrives
The model runs a forward pass over your entire prompt before generating token 1. TTFT measures this. Streaming cuts perceived latency by exposing the decode loop immediately after prefill.
Every major provider (OpenAI, Anthropic, Gemini) uses Server-Sent Events. Each event is data: {…}\n\n. Chunks from ReadableStream don't align with event boundaries — the consumer must buffer.
Calling abort() signals the stream factory to stop emitting. Partial text stays visible. In production, this cancels the HTTP request, saving GPU time and reducing costs.
Accumulate tokens in a ref, flush to state on requestAnimationFrame. Decouples the 30–80 tok/sec stream rate from React reconciler. Without this, you flood the scheduler and drop frames.