💳 AI API Cost Calculator

Estimate AI API costs from input, cached-input, and output tokens, request volume, and provider rates. Compare daily and monthly LLM spend.

✓ Formula shown✓ Worked example✓ Browser-only calculation✓ Updated 2026

Calculate AI API Cost

Presets are editable assumptions and should be checked against the provider’s current pricing page.

What this AI API cost calculator calculates

Estimate the cost of an LLM application before it reaches production. The calculator separates normal input tokens, cached input tokens, output tokens, requests, and optional fixed tool-call charges so the result is more realistic than a single blended token rate.

Use the cost per successful request—not only cost per request—when comparing models. A cheaper model may cost more overall if retries, failures, or longer prompts are required.

AI API Cost Calculator formula

Total cost = (input tokens ÷ 1,000,000 × input rate) + (cached tokens ÷ 1,000,000 × cached rate) + (output tokens ÷ 1,000,000 × output rate) + fixed request or tool charges.

Assumptions and limitations

The result is an engineering estimate based on the values entered. AI models, tokenizers, runtimes, accelerators, cloud services, and provider billing rules differ. Validate important decisions with measured data from the exact model, hardware, framework, and pricing plan you intend to use.

Worked example

At 10,000 requests per day, 1,500 input tokens and 300 output tokens per request, an input rate of $2.50/M and output rate of $15/M produces $82.50 per day before caching or tool fees.

How to use the result

Use the cost per successful request—not only cost per request—when comparing models. A cheaper model may cost more overall if retries, failures, or longer prompts are required.

  1. Start with representative production assumptions rather than best-case demos.
  2. Run a low, expected, and high scenario to understand the range.
  3. Record model version, pricing date, hardware, precision, and workload details.
  4. Replace assumptions with observed p50 and p95 measurements after testing.

Common mistakes to avoid

  • Using one blended token rate when input and output prices differ substantially.
  • Ignoring cached-input pricing, tool calls, web searches, retries, and failed requests.
  • Treating a preset as permanent pricing instead of recording the provider and last-checked date.
Pricing note: Provider rates can change. Presets are planning conveniences, not a live price feed. Verify the selected model, region, tier, caching rules, batch eligibility, and tool charges on the provider’s official pricing page before making a budget decision.

Frequently asked questions

How accurate is an AI API cost estimate?

It is accurate for the rates and usage assumptions entered. Production spend can differ because prompts vary, retries occur, tool calls add fees, and provider pricing changes.

Should cached tokens be entered separately?

Yes. Providers that support prompt caching often price cache reads differently from ordinary input tokens. Separating them prevents over- or under-estimating cost.

Does the calculator send prompts to an AI provider?

No. All calculations run locally in your browser; no prompt text or token usage is transmitted.

Related AI calculators

Methodology and privacy

This educational tool uses the formula and assumptions displayed on the page. Calculations run locally in your browser, and the page does not transmit the values you enter. Results are estimates rather than provider quotes, benchmark guarantees, financial advice, or capacity guarantees. Last methodology review: August 2, 2026.

Formula Explorer connections

Interpretation: total cost is a weighted sum of input, cached and output tokens plus any fixed tool charges. Output tokens often have a different rate. Assumption: rates and usage entered must match the provider, model and billing period; retries and agent steps multiply request volume.

Token Count →Caching Savings →Agent Cost →CS & AI Formula Explorer →