Work out prompt token cost instantly with clear inputs, formula shown and shareable results.
LLM APIs price input and output tokens separately, and output is typically three to five times more expensive because it is generated sequentially rather than processed in parallel. Cost per call is therefore input tokens times input price plus output tokens times output price, both divided by a million. Trimming a long system prompt helps, but capping output length usually saves more.
Per-call cost
cost = (input tokens x input price + output tokens x output price) / 1,000,000
Prompt tokens are processed in one parallel forward pass, while each output token requires its own decoding step. The provider's cost per output token is genuinely higher.
Yes. Cached prefix tokens are usually billed at a large discount, so a stable system prompt reused across calls costs a fraction of the full input rate.