Learn to calculate by playing with API cost calculator
A short game to see where the result comes from. Pick a language and start; you can stop halfway and come back.
Loading the game…
What you will practise
Monthly and annual spend on an API with a fixed fee and volume pricing, to compare up to three plans and see when each one pays off.
How it works
For each plan, included requests are subtracted, the excess is billed at the per-thousand price and the fixed fee is added. Real cost per request spreads the whole bill over every call.
The annual cost adds up twelve months; if usage grows, each month multiplies volume by (1 + growth). The break-even volume between two plans is where they cost the same: below it one is better, above it the other.
Formula
Billable = max(0, requests − included)
Monthly cost = fixed fee + billable ÷ 1,000 × price
Annual cost = sum over 12 months, with volume × (1 + growth)^month
Break-even between two plans: the volume where cost₁ = cost₂ (solved piece by piece)
Worked example
Example 1. A single plan.
250,000 requests a month, 50,000 included, 0.40 per thousand and a fee of 29: variable portion 80, monthly cost 109, annual 1,308 and 0.000436 per request.
Example 2. Three plans.
Plan 1: no fee or allowance, 0.50 per thousand. Plan 2: fee 49, 100,000 included, 0.30 per thousand. Plan 3: fee 199, 1,000,000 included, 0.10 per thousand. At 250,000 requests a month they cost 125, 94 and 199: plan 2 wins, saving 372 a year. Plan 1 is better below 98,000 requests; plan 3, above 600,000.
Example 3. With growth.
The same three plans with 5% monthly growth: plan 2 is still the cheapest (1,421.78 a year) and the saving against plan 1 rises from 372 to 567.86.
Example 4. Heavy volume.
At 3,000,000 requests a month, plan 3 costs 399 a month against 919 for plan 2 and 1,500 for plan 1.
How to play
First pick your language. Then work through the challenges one by one: each sets out a case with real numbers and, if you get stuck, you can ask for a hint. When you answer, you see whether you got it right and why. Progress is saved only in your browser, so you can stop halfway and carry on another day.