Where the money goes per token: a diagram of LLM API cost anatomy

cneuralnetwork · x · 2026-11-01

A shared infographic breaks down the end-to-end cost of a single LLM API call: prompt → tokenise → prefill (once, builds the KV cache over all input tokens) → decode (repeated, generates output tokens using the KV cache).

You pay for three things: prefill compute on input tokens, decode compute on output tokens, and the memory to keep the KV cache — which scales with context length, explaining why long-context calls cost more.

Original post →

More from Infra

Infra channel →