API cost calculator

API and Token Cost Calculator

Estimate usage-based API cost from input units, output units, request count and provider pricing.

Useful for AI, search and metered APIs

Many API products price input and output separately, while others combine unit pricing with per-request fees, minimum monthly commitments, batch discounts, caching discounts or premium latency tiers. Use this calculator for a transparent first estimate before modeling provider-specific details.

Example

If input usage is 1,000 thousand units at $0.005, input cost is $5. If output is 250 thousand units at $0.015, output cost is $3.75 before any request fee.

Common mistakes

Do not combine input and output units when the provider prices them differently. Include retries, failed billable calls and batch/caching discounts when they apply.

How to make the estimate more realistic

Measure a representative sample of requests, split short and long outputs, include retry behavior, and add a safety buffer for failed calls that are still billable. For AI workloads, track average input and output tokens separately because output can be priced differently from input.

Last reviewed: 2026-05-17

Before relying on this result

Use this calculator together with the formula, assumptions, limitations and examples on the page. If the topic involves health, tax, lending, investment, legal, safety or current-rate decisions, treat the number as an estimate and check the relevant primary source or professional guidance.

Calculator metadata last reviewed: 2026-05-14.