Simulating production costs? Try our free browser-based TokenMeter Cost Calculator Open calculator →

Prompt Caching Calculator: Bedrock vs Gemini Pricing (2026)

Bedrock prompt caching pricing, Gemini context caching and OpenRouter routing in one model, plus the calculator that shows when caching actually pays.
Onsp

You enabled prompt caching, the hit rate is 92%, and the bill barely moved. That is not a bug. A cache hit discounts input tokens, but it arrives with a write premium and a time-to-live clock, and on Amazon Bedrock those two numbers can eat the saving before you notice.

It covers Bedrock's three cache token classes, the Gemini context caching model that works almost the opposite way, what OpenRouter does to both, and the microeval habit that stops you freezing a bad prompt behind a cache. Every figure is reproducible in the AI cost calculator.

Bar chart of monthly Bedrock spend on Claude Sonnet 5 for one workload: $3,204 with no caching, $1,476 with a five-minute cache and $727 with a one-hour cache
The same workload, three cache policies. The cheapest option is not the biggest discount.

The three numbers that decide whether caching pays

Ignore the marketing percentage. A cached prompt has three costs:

  • Write premium. Storing a prefix costs more than sending it once — 1.25× the base input rate on Anthropic models, including Claude on Bedrock.
  • Read discount. A hit bills at 0.10× the base input rate, a 90% saving per token read.
  • Write frequency. The cache expires, and every refresh pays the premium again. At high traffic this is the largest line item.

Most teams model the middle number and ignore the third, which is how a 90% discount becomes a 4% invoice reduction.

Bedrock prompt caching pricing, line by line

Bedrock bills the same token classes as the Anthropic API. What changes is where the cache lives and which models support it. Here is Claude Sonnet 5 at $2.00 per million input and $10.00 per million output:

Token classMultiplierPer 1M tokensWhen you pay it
Uncached input1.00×$2.00Every token outside the cached prefix
Cache write1.25×$2.50Once per prefix per five-minute window
Cache read0.10×$0.20Every hit, for the cached tokens only
Output—$10.00Every generated token, cache or not

Five rules, each with a billing consequence:

  • Five-minute TTL, refreshed by use. An active workload keeps the prefix warm; a nightly batch every four hours writes four times as often as it reads.
  • Up to four cache breakpoints. Put them at the end of blocks that repeat: system instructions, tool schemas, then retrieved documents.
  • Minimum cacheable length. About 1,024 tokens for Sonnet and Opus, 2,048 for Haiku. Shorter prompts are silently not cached — and bill at full rate.
  • No storage line. The five-minute cache is included in the write premium; you are not billed per hour to keep it.
  • Longer TTL costs more per write. Anthropic prices a one-hour cache at 2× base input on the direct API. Confirm availability in your Bedrock region before budgeting on it.

A worked example: $3,204 down to $727

Take a support assistant on Claude Sonnet 5: a 40,000-token prefix (system prompt, tool definitions, policy corpus), 2,000 tokens of conversation per request, 500 output tokens, 1,200 requests a day for 30 days — 36,000 requests a month. The five-minute cache is rebuilt 8,640 times a month; the one-hour cache, 720 times.

Line itemNo caching5-minute TTL1-hour TTL
Cache writes—$864$115
Cache reads—$288$288
Variable input$3,024$144$144
Output$180$180$180
Total$3,204$1,476$727

Writes are 58% of the cached bill: the prefix is rebuilt 288 times a day even though it never changes. A one-hour TTL writes 12× less often and, even at twice the write rate, is the cheapest policy by a wide margin.

Why the write count, not the discount, decides

The monthly model:

monthly = N x (P x r_read + V x r_in + O x r_out)
        + W x P x r_write

N = requests per month      P = cached prefix tokens
V = variable input tokens   O = output tokens
W = cache writes per month  r_* = rate per token

The break-even is simpler still. A write costs $0.50 per million tokens above base; each read saves $1.80. Caching pays for itself on the first re-read inside the TTL. The real question is how often you pay to rebuild it.

Context caching on Gemini: implicit and explicit are different products

Google solves the same problem twice, with opposite cost shapes.

Implicit caching is automatic. Send the prompt as usual; Google detects a repeated prefix and bills cached tokens at the cached rate — $0.075 against $0.75 per million on Gemini 3.8 Flash, a 90% discount in the October 2026 rate card. No write premium, no storage fee, no API change. The catch: the hit rate is Google's decision, not yours.

Explicit caching is a resource you create with a token count and a TTL. You pay cached rates on every read plus storage per token-hour, with a minimum billing window. In exchange the cache lives exactly as long as you say — which matters when traffic is bursty.

Run the support workload through Gemini 3.8 Flash at an 80% implicit hit rate and input falls from $1,134 to $356, with output unchanged at $68: $1,202 becomes $424, a 65% cut. At a 100% hit rate it drops to $230. No writes, no TTL arithmetic — which is why implicit caching wins when reuse is unpredictable.

When explicit caching beats implicit

  • The corpus is large and stable enough that a guaranteed cache justifies a storage line item.
  • Traffic arrives in bursts with long gaps, so implicit reuse would be discarded.
  • You need a predictable hit rate for budgeting rather than a best-effort one.

OpenRouter: the cache follows the router

OpenRouter is a pass-through: you pay upstream token rates plus a fee on credit top-ups, not a per-token markup. That is neutral for caching until routing moves your request.

A prompt cached on one provider is not cached on another, nor in a different region of the same one. An auto-router optimising for price or latency will happily send request 2 elsewhere, miss, and pay a fresh write. Three rules prevent it:

  • Pin the provider order for cache-sensitive workloads and treat the pin as part of the cost model.
  • Check the response, not the dashboard. Cached token counts appear in the usage object; zeros mean the route is wrong.
  • Compare routes at your hit rate. The cheapest list price is rarely the cheapest route once writes and misses are included.

Microevals: the cheapest insurance before you freeze a prompt

A microeval is a small, fast test set — 20 to 100 cases — with deterministic checks, run on every prompt change. It is a regression test for the task you ship: did extraction still return valid JSON, did the classifier still pick the right label, did the answer still cite the right clause.

Caching raises the stakes. Once a prefix is cached it is frozen: system prompt, tool schemas and few-shots become a paid, versioned artefact. Changing one word invalidates the cache and forces a fresh write on every route. Find out that the new wording broke extraction before it costs money.

  1. Pull 30 failures from production logs, not from imagination.
  2. Write one assertion per case: exact label, valid schema, required citation.
  3. Record the baseline pass rate and the token cost of a run.
  4. Change the prompt, rerun, compare pass rate and cost.
  5. Only then invalidate the cache and deploy.

Thirty cases at 3,000 input and 500 output tokens cost about $0.33 per run — cheaper than one bad cache write.

Run the numbers in an AI cost calculator, not a spreadsheet

Four inputs decide the answer: prefix size, requests, cache policy and output length. The rest is arithmetic that changes with every provider update.

  1. Open the AI model calculator and pick the model you actually call — Claude Sonnet 5 and Gemini 3.8 Flash are both in the dataset.
  2. Enter prefix and per-request tokens; the calculator separates cached, uncached and output tokens.
  3. Switch the cache assumption between 0%, your measured hit rate and 100%. The spread is your risk.
  4. Compare both models in the head-to-head breakdown before committing.

When caching loses money

  • Prompts under the minimum length. Nothing is cached, and you pay full rate with a false sense of optimisation.
  • Prefixes that change every call. User-specific instructions at the top guarantee a write and zero reads.
  • Long gaps between requests. A 20-minute interval means four rebuilds for every reuse.
  • Output-heavy workloads. Caching does nothing for output, which is 4–5× input on almost every model.

FAQ

How much does Bedrock prompt caching cost?

You pay 1.25× the base input rate to write a prefix, 0.10× to read it, and nothing extra for the five-minute cache. On Claude Sonnet 5 that is $2.50 per million written tokens and $0.20 per million read tokens.

Is Gemini context caching cheaper than Bedrock?

It depends on reuse. Gemini's implicit cache has no write premium, so it wins on irregular traffic. Bedrock's explicit cache wins when a large prefix is reused continuously.

Does OpenRouter support prompt caching?

Yes, as a pass-through. Whether a request hits depends on the provider and region the router selects, so pin the provider order and verify cached token counts in the usage object.

What are microevals?

A small deterministic test set — usually 20 to 100 cases — run on every prompt or model change to catch regressions in one task. They cost cents per run and reveal quality and cost before you freeze a prompt behind a cache.

How do I calculate AI cost per month?

Multiply requests by cached input, uncached input and output tokens at their rates, then add writes: requests × prefix × write rate ÷ TTL windows. The free calculator handles all four terms, including long-context and batch modifiers.

Related reading

Your next step is one number: how many times per month your cache is rebuilt. If it is more than your request count divided by ten, the TTL costs more than the model. Run your prefix through the free AI cost calculator.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.