Why do hosted LLM APIs charge separate per-million rates for input and output tokens?
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).
Detailed answer & concept explanation~4 min readEverything 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. 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.
- Claude Sonnet 4.6 publishes $3/M input and $15/M output (5x ratio), with cache reads at $0.30/M (0.1x of input).
- GPT-5.5 charges roughly $5/M input and $15/M output, with cached input at 0.5x on prefixes of 1024+ tokens.
- Gemini 3.1 Pro on Google AI Studio splits input/output rates similarly, with separate per-million prices visible in the pricing console.
- Self-hosted vLLM and SGLang on Llama 4 Maverick show the same asymmetry directly: GPU utilization is near 100 percent during prefill and 30-50 percent during decode.
- DeepSeek V4's hosted API charges a notably smaller input/output ratio (closer to 2x) because their MoE routing reduces decode cost per active expert.
What an interviewer would ask next. Try answering before peeking at the approach.
QIf output is so much more expensive, why do providers not just charge a single blended rate?
QHow does the input/output cost ratio change for a small model versus a large MoE model?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
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.
Same topic, related formats. Practice these next.