Streaming, token budgets and cost
medium 7 minStreaming reveals progress before generation is complete.
Trace the example
Follow the evidence through each stage, then test a change in the case.
One request, three clocks and one bill
Application
1,200 input tokens
Reserve enough context for the answer. For this example use fictional prices of $2 per million input tokens and $8 per million output tokens.
The connection drops after the first text event. Is the displayed prefix a completed result?
Estimate a completed request
Illustrative prices are USD 2 per million input tokens and USD 8 per million output tokens.