AI API Cost Calculator

Estimate API costs for any model by token volume and request count

Pricing limits: Automatic prompt-tier selection is available only when the result explicitly identifies the applied tier. Other results use catalog rates and can understate long-prompt costs. Prompt thresholds count uncached plus cached input tokens per request, not monthly volume. Cache writes/storage, tool charges and batch/priority rates are excluded unless explicitly stated. Announced Google price increases are a warning, not current rates: verify the effective date on the official pricing page.
How to use this tool: Choose a provider and model, enter the typical tokens in one request, then add how many requests you expect in the selected period. Your monthly and annual estimates update automatically. Tap the ⓘ icons for examples.

Request Workload

Catalog-rate estimate only. No automatic prompt-tier selection for this model. Long prompts may have higher rates; verify the provider’s pricing before budgeting.
Source: Official provider documentation. Estimates are informational.

What this tool helps you decide

The AI API Cost Calculator turns a rough usage plan into a concrete monthly and annual number so you can answer three practical questions before you write production code: is this feature affordable at the volume you expect, which model tier fits your budget, and how sensitive your bill is to changes in prompt size or output length. It is a planning aid for scoping a build, comparing model tiers, and setting a budget alert — not a billing reconciliation tool.

Because API spend scales with tokens rather than requests alone, small changes to how much context you send and how long each answer is can move the total dramatically. Modelling those inputs up front is usually cheaper than discovering them on your first invoice.

How to use the result

Treat the monthly figure as the centre of a range, not a promise. Run the calculation twice — once with your expected inputs and once with a heavier “busy month” workload (higher request count, longer prompts) — and use the two numbers to bracket a budget. The per-request cost is the most portable metric: multiply it by your realistic traffic to sanity-check the monthly total, and use it to compare directly against the same workload in the model comparison tool.

  • Set a billing alert slightly above your “busy month” estimate, not the average.
  • If output cost dominates, consider capping response length before switching models.
  • If input cost dominates, look at trimming context or reusing cached input where supported.

Illustrative planning scenarios

The scenarios below show how request volume, prompt size, output length, context reuse, and model choice pull the budget in different directions. The numbers are structural assumptions to illustrate the levers — not measured provider benchmarks or price quotes. Enter your own figures above for an estimate using catalog pricing. Check the source and verification date before budgeting.

Customer support assistant

A chat assistant answering account and product questions, with a system prompt and retrieved help-centre snippets attached to each turn.

Illustrative planning assumptions — not provider benchmarks
  • High request volume, many short conversations per day
  • Moderate input per request (system prompt + a few retrieved snippets)
  • Short-to-moderate output length per reply
  • Repeated system prompt makes cached input a meaningful lever

What this suggests: Cost is driven by request volume and repeated context. Caching the stable system prompt and keeping answers concise usually matters more than the raw per-token price.

Internal document Q&A

Employees ask questions against internal docs; relevant passages are retrieved and passed as context for each answer.

Illustrative planning assumptions — not provider benchmarks
  • Lower request volume than a public assistant
  • Large input per request (several retrieved passages)
  • Moderate output length with citations
  • Prompt size grows if retrieval returns more passages than needed

What this suggests: Input tokens dominate. Tightening retrieval so you send fewer, more relevant passages can reduce cost as much as choosing a cheaper model.

Large-scale document summarization

A batch job that summarises a backlog of long documents on a schedule rather than in real time.

Illustrative planning assumptions — not provider benchmarks
  • Very large input per request (full documents)
  • Compact output per request (a structured summary)
  • Predictable, schedulable volume rather than spiky live traffic
  • Batch or off-peak processing may be available for some providers

What this suggests: Total input volume is the whole story. Chunking long documents, limiting summary length, and using batch pricing where available are the main cost levers.

Decision factors & limitations

A few structural factors change your real bill beyond what a single estimate can capture:

  • Tokenizer differences: each model counts tokens slightly differently, so the same text can cost more on one model than another even at the same headline price.
  • Prompt and history growth: multi-turn conversations resend prior context, so input cost climbs across a session unless you truncate or summarise history.
  • Retries and failures: timeouts and re-runs consume tokens that a clean estimate ignores.
  • Discounts not modelled: committed-use, enterprise, batch, and regional pricing can lower your actual cost below the standard pay-as-you-go rates shown here.

Pricing shown is standard pay-as-you-go. Official sources are checked on a recurring schedule. Unusual or structural changes are held for human review. Always confirm against the provider’s official pricing page before committing to a budget.

Sources & methodology

See how prices are collected, normalised, and reviewed, and which providers are currently verified:

How this calculation works

This calculator uses standard pay-as-you-go token rates, cache-read rates, per-request fees, and embedding-only billing where available. Verified direct Anthropic Haiku 5.5 and supported xAI prompt tiers are selected using total uncached plus cached input per request. Other models use catalog rates without automatic tier selection. Batch, priority, cache writes, cache storage, and tool fees are not included.

Frequently Asked Questions

How accurate are these API cost estimates?
These are planning estimates, not invoices. Only explicitly identified prompt tiers are selected automatically; other models use catalog rates and may cost more for long prompts. Tokenization, cache writes, storage, tool fees, and service tiers can also change actual billing.
Does this include enterprise discounts?
No. The calculator uses standard pay-as-you-go pricing. If you have committed use discounts or enterprise agreements, your actual costs will be lower.
Why do some models show a per-request fee?
Models like Perplexity Sonar charge both for tokens and for each API request (covering real-time web search). The calculator includes both components so you see the true cost.