Why do hosted LLM APIs charge separate per-million rates for input and output tokens?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Input tokens run in one parallel compute-bound prefill pass; output tokens run one-at-a-time in bandwidth-bound decode steps. Output is 3-5x more expensive, so providers split the rate.
Imagine the kitchen has to prepare a dish in two stages. The first stage is dumping all the ingredients on the counter at once and chopping them in parallel: ten cooks each take a knife and finish the prep together in a single minute. The second stage is plating, where only one cook can place one bite at a time onto the plate while everyone else stands around. The first stage is fast and cheap per ingredient; the second stage is slow and expensive per bite. That is exactly why your bill from a hosted LLM splits input tokens (cheap prep) from output tokens (expensive plating).
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: prefill parallel and compute-bound + decode sequential and bandwidth-bound + 3-5x pricing ratio + prefix caching discounts (0.1x Anthropic, 0.5x OpenAI) + MoE skews the ratio.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming input and output cost the same because they are both tokens. The asymmetry is structural: one phase is compute-bound, the other is bandwidth-bound, and the provider passes that through.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.