Cost Per Token Explained: Read LLM Pricing Like a Pro

Cost per token explained: input vs output pricing, per-million-token math, and how to compare LLM pricing across providers without spreadsheets.

LayerFlow Team6 min read
Cost Per Token Explained: Read LLM Pricing Like a Pro — LayerFlow blog illustration

LLM pricing is quoted per million tokens, with separate rates for input and output. Cost per token sounds simple — but output tokens cost 2-10x input tokens, and context length changes the total fast.

Input vs output pricing

Input tokens are everything you send (system prompt, context, user text). Output tokens are what the model generates. Most providers charge significantly more for output — sometimes 2-10x — because generation is compute-heavy.

The per-token math

  1. Take input tokens ÷ 1,000,000 × input price.
  2. Take output tokens ÷ 1,000,000 × output price.
  3. Add the two for total cost.
  4. Multiply by expected requests per month.

Worked example

Hidden factors that change the real price

  • Prompt caching discounts on cached prefixes.
  • Batch/async pricing at lower rates.
  • Free-tier quotas and trial credits.
  • Context length: long prompts raise input cost per call.
  • Retries and loops: re-sent context adds up.

Comparing providers fairly

  • Compare same task, same length — not just listed prices.
  • Factor in cache and batch discounts.
  • Include quality: a cheap model that fails costs more in retries.
  • Use your real prompt mix, not marketing examples.

FAQ

Why is output more expensive than input?+

Generating tokens is compute-heavy compared to processing input, so providers price output higher — often 2-10x.

How do I compare LLM pricing?+

Use your real prompt mix and compute total monthly cost including output, caching, and batch discounts — not just the listed input price.

What does 1 million tokens mean?+

Roughly 750,000 words of English text, or about 25,000 typical API requests with moderate context.

Related posts

LayerFlow

Try the AI workspace

Save prompts, compare models, and set hard budgets in one place.