Computing & Software

Token-Based API Cost Scenario Calculator

Plan input, cached-input and output token charges using rates you supply per million tokens.

How the calculation works

Uncached input cost = (input_tokens-cached_tokens)/1e6*input_rate currency. Cached input cost = cached_tokens/1e6*cache_rate currency. Output token cost = output_tokens/1e6*output_rate currency. Total token charge = (input_tokens-cached_tokens)/1e6*input_rate+cached_tokens/1e6*cache_rate+output_tokens/1e6*output_rate currency.

Worked example

Example inputs — Total input tokens including cached tokens: 1000000; Cached subset of input tokens: 200000; Output tokens: 100000; Uncached input price per million tokens (your currency): 2; Cached input price per million tokens: 0.5; Output price per million tokens: 8. Expected results — Uncached input cost: 1.6 currency; Cached input cost: 0.1 currency; Output token cost: 0.8 currency; Total token charge: 2.5 currency.

Assumptions and limits

Analytical software/hardware scenario, not a benchmark or a live provider quote. Use the actual architecture, workload and billing definitions; overheads not named in the model are excluded. Example rates are hypothetical, not current provider prices. Token counts must come from the actual tokenizer/usage report. Tool fees, storage, batch discounts and taxes are excluded.

Reference and further reading

Read the underlying subject reference. Calculith is an independent implementation; the reference does not endorse or certify this tool.

Related calculators

Browse all 1000 calculators →

Example values are editable. Results are estimates where assumptions apply. Calculations run in your browser. Updated 2026-11-16.