LLM API Cost Calculator: Context Window & Prompt Caching

Compare monthly LLM API spend across Claude, OpenAI and Gemini models, with prompt-cache hit rate, Batch API discount and your own per-million-token rates. Everything is calculated in your browser.

How the cost is worked out

  • Each request pays for the cached prefix, the new input and the output.
  • A cache hit reads the prefix at the cache-read rate. A miss writes it at the cache-write rate.
  • The Batch API option halves the whole bill, and it stacks with caching.
  • Monthly spend is 30 days of the daily request count.
  • Models are ranked from cheapest to dearest, with the savings from caching and Batch shown separately.

About the prices

The presets are the per-million-token rates listed on the pricing pages of Anthropic, OpenAI and Google on 2026-12-06. Every number is editable, and you can add your own model. Prices change often, so check the provider before you commit to a budget.

FAQ

How much does prompt caching save?

It depends on your hit rate and how large the repeated prefix is. At a high hit rate the prefix costs a fraction of the normal input rate. At a low hit rate the cache-write premium can make it cost more than not caching, which is why the table shows savings as negative when that happens.

Why does the Haiku 5.5 price change with prompt size?

Anthropic lists higher rates for Haiku 5.5 when the whole prompt is over 100,000 tokens. The calculator switches to that tier automatically when the cached prefix plus new input passes the limit.

Do the OpenAI and Gemini cache-write rates apply to me?

The OpenAI preset uses the 30-minute cache-write rate from its pricing page. If you only use automatic caching, set the cache-write rate equal to the input rate. Gemini 4 caches implicitly, so its write rate equals input.

What is not included?

Cache storage fees, tool and search calls, image and audio tokens, long-context surcharges above the tiers listed, regional pricing uplifts and any free tier or committed-use discount.

Is anything sent to a server?

No numbers or model rates you enter are sent. The page only counts that it was opened and used, with no personal data.