AI API Cost Calculator — OpenAI, Claude & Gemini
Work out the monthly bill before you ship an LLM feature. Pick a model, enter your tokens and request volume, and see the cost per request and per month in USD and Sri Lankan rupees — with a cheapest-first table of every model and optional batch and cache discounts. No signup, sources cited below.
How it works
Large-language-model APIs price input (prompt) tokens and output (completion) tokens separately, quoted in US dollars per 1,000,000 tokens. Output is always more expensive — 3–5× on every model in this table — because the model runs a full forward pass to generate each output token, whereas input tokens are read in one batched pass. That single fact is why your bill is usually driven by how much the model writes, not how much you send.
For a chosen model with input price Pin and output price Pout (USD per 1M tokens), the calculator runs:
- Monthly token volumes:
inTokens = inputPerReq × requestsandoutTokens = outputPerReq × requests. - Base cost:
inputCost = inTokens ÷ 1e6 × PinandoutputCost = outTokens ÷ 1e6 × Pout. - Cached input (if enabled): the cached fraction
cof input tokens is billed at the provider's cache-read multiplierminstead of full price, soinputCost = inTokens ÷ 1e6 × Pin × ((1 − c) + c × m). Anthropic cache-read is 0.1×; OpenAI cached input is 0.25–0.5× by family; Google context-cache read ≈ 0.25×. - Batch (if enabled): batch-eligible providers discount both input and output by 50% (× 0.5), applied after the cache adjustment.
- Monthly total =
inputCost + outputCost; per request = total ÷ requests; LKR = USD × your editable CBSL rate.
Every per-1M figure in the underlying data module carries an inline source URL, and the math is reconciled against a second independent per-1,000-token formula so the arithmetic can't drift. The comparison table reruns this for all models on every input change and sorts cheapest-first, so a lower-cost substitute is always one glance away.
Worked examples
Frequently asked questions
Sources & references
- Anthropic — Claude API pricing (per-1M input/output)
- Anthropic — prompt caching (cache-read multiplier)
- OpenAI — API pricing (list, batch, cached input)
- Google — Gemini API pricing
- OpenAI — what are tokens (≈4 chars / 0.75 words per token)
- Central Bank of Sri Lanka — indicative exchange rates
Prices were last cross-checked against these sources on 2026-06-30. This tool is a calculator over a snapshotted price table, not a live feed — confirm the current rate on the official page before committing a budget.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Spotted a stale price, edge case, or want another model added?
Email me at [email protected] — most fixes ship within 24 hours.