Free tool

AI API Cost Calculator

Estimate your monthly OpenAI, Anthropic or other LLM API bill from your own traffic and token counts, then see how much caching, batching, model routing and context trimming could save.

Your workload

Prices per 1M tokens

Example tiers are illustrative. Check current rates on the OpenAI or Anthropic pricing pages and enter the rates for your model.

Estimated monthly cost

$0

Per request$0
Per year (flat)$0
Next 12 months with growth$0
Input $0Output $0

What could you save?

Adjust the levers to model common optimizations.

Shorter conversation history, fewer retrieved chunks, leaner system prompts.

Put stable instructions and tool definitions first so the provider can cache them.

Classification, extraction and short summaries often run well on a smaller model.

OpenAI and Anthropic both offer asynchronous batch APIs at a 50% discount for work that can wait up to 24 hours.

Output limits, tighter response formats, no unrequested explanations.

Optimized monthly cost

$0

Monthly savings$0
Annual savings$0

These are estimates from simplified assumptions. Real savings depend on whether quality holds after each change, which is what an audit tests.

Get an AI Spend Audit

How the calculation works

Cost per request is the input tokens multiplied by the input price, plus cached input tokens multiplied by the cached price, plus output tokens multiplied by the output price, all divided by one million. Monthly cost assumes 30 days. The 12-month figure compounds your growth rate monthly.

The savings model applies each lever in turn: context trimming reduces uncached input, caching moves input to the cached rate, routing prices part of the traffic at the smaller model's rate, batching halves the price of the batched share, and output cuts reduce output tokens. It does not include tool calls, embeddings, image or audio tokens, or provider minimums.

For a deeper explanation, read Why your OpenAI API bill keeps climbing.

Common questions

How is AI API cost calculated?

Each request costs (input tokens x input price + output tokens x output price) divided by one million, using the provider's price per million tokens. Cached input tokens are billed at a lower cached rate where the provider supports prompt caching. Monthly cost is the cost per request multiplied by requests per month.

Why do output tokens matter so much?

Output tokens are typically priced several times higher than input tokens, and reasoning models bill their hidden reasoning as output. A verbose response format can cost more than a long prompt.

Where do I find my average tokens per request?

Every API response includes a usage object with input, output and cached token counts. Log it for a day or a week, then divide total tokens by the number of requests.

Are the example prices current?

The example tiers are illustrative. Providers change prices and release new models often, so enter the current rates from the provider's official pricing page for the model you use.