cd /news/large-language-models/why-prompt-caching-changes-your-real… · home › topics › large-language-models › article
[ARTICLE · art-177973] src=dev.to ↗ pub= topic=large-language-models verified=true sentiment=↑ positive

Why Prompt Caching Changes Your Real LLM API Bill (GPT-4o vs Claude vs Gemini vs DeepSeek)

A developer built a browser-only LLM API cost calculator, hosted on Cloudflare Pages, that models prompt caching by splitting input volume into cached and uncached tokens rather than applying flat input rates. The tool argues that spreadsheets multiplying raw input and output token prices overstate real production bills by 3x to 6x, since 60%–85% of input tokens in agentic and RAG workflows are repeated across requests and cached tokens typically cost 50% to 90% less depending on provider.

recommendation

Model LLM API costs with a cached-versus-uncached input split and a realistic cache-hit ratio; the source estimates flat-rate spreadsheets overstate production bills by 3x to 6x.

more in playbook: Controlling LLM cost
read1 min views4 publishedNov 29, 2026

When developers compare LLM APIs, most spreadsheets only multiply raw input and output token rates. In production apps—especially coding assistants, RAG pipelines, and chat agents—that calculation is often off by 3x to 6x.

In almost every agentic or RAG workflow, 60%–85% of your input tokens are repeated across requests:

With prompt caching enabled, cached input tokens typically drop by 50% to 90% depending on the provider.

Instead of using flat input pricing, split your monthly input volume into cached vs. uncached tokens:

interface ModelPricing {
  inputPer1M: number;
  cachedInputPer1M: number;
  outputPer1M: number;
}

export function estimateMonthlyUsd(
  requestsPerDay: number,
  avgInputTokens: number,
  avgOutputTokens: number,
  cacheHitRatio: number, // 0.0 to 0.95
  pricing: ModelPricing
): number {
  const monthlyReqs = requestsPerDay * 30;
  const uncachedIn = (monthlyReqs * avgInputTokens * (1 - cacheHitRatio)) / 1_000_000;
  const cachedIn = (monthlyReqs * avgInputTokens * cacheHitRatio) / 1_000_000;
  const out = (monthlyReqs * avgOutputTokens) / 1_000_000;

  return uncachedIn * pricing.inputPer1M + cachedIn * pricing.cachedInputPer1M + out * pricing.outputPer1M;
}

Because I got tired of rebuilding this spreadsheet every time a new model dropped, I built a fast, 100% browser-only benchmark calculator on Cloudflare Pages:

What cache hit rates are you seeing in production? Drop your stack in the comments!

── more in #large-language-models 4 stories · sorted by recency
── more on @cloudflare pages 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/why-prompt-caching-c…] indexed:0 read:1min 2026-11-29 · —