#794 · AI & Technology Tool

Prompt Caching Cost per Task Calculator

Estimate the marginal and fully allocated cost of one prompt-cached task. Enter separate token prices for uncached input, cached input, and output, then allocate optional cache-storage expense across the tasks completed while the cache is retained. The breakdown shows where spend comes from and compares the cached scenario with processing the entire prompt at the uncached-input rate.

Calculator

Pricing and task assumptions
tokens
Input tokens billed at the standard input rate.
tokens
Reusable input tokens billed at the cached rate.
tokens
Generated tokens billed at the output rate.
$/1M
Price per one million uncached input tokens.
$/1M
Price per one million cached input tokens.
$/1M
Price per one million generated tokens.
$/hour
Optional cache retention or storage charge.
tasks/h
Tasks sharing the hourly storage cost.
tasks
Optional volume for monthly projection.

How to use this calculator

  1. Enter average uncached, cached, and output tokens for one task.
  2. Enter provider prices per one million tokens for each token class.
  3. If applicable, enter hourly cache storage cost and the tasks sharing it.
  4. Use cost per task for unit economics and the monthly projection for budgeting.

Formula

Token cost/task = (uncached tokens × input price + cached tokens × cached price + output tokens × output price) ÷ 1,000,000
Storage/task = storage cost/hour ÷ tasks/hour
Total cost/task = token cost + storage/task

What the result means

The main result is fully allocated cost per task. Savings compares this with billing all input tokens at the uncached input rate while keeping output and allocated storage unchanged.

Prices vary by provider, model, cache-write rules, retention duration, region, and date. Enter current contract prices; taxes, network fees, retries, and non-model infrastructure are excluded unless added separately.

Example calculation

For 800 uncached input tokens at $3/M, 3,200 cached tokens at $0.30/M, 400 output tokens at $15/M, and no storage charge:

Input = $0.0024
Cached input = $0.00096
Output = $0.006
Total = $0.00936 per task
Savings vs uncached prompt = $0.00864

Tips for better results

  • Use current provider prices instead of a generic benchmark.
  • Include cache-write charges in the appropriate input price if billed.
  • Allocate retention cost only across tasks that actually reuse the cache.
  • Model retries by increasing average tasks or token counts appropriately.
  • Compare several cache-hit and output-length scenarios.

Frequently asked questions

Does the calculation include cache-write charges?

Only if you incorporate them into the entered prices or storage cost. Provider billing models differ.

Why is storage cost divided by tasks per hour?

That allocates one hour of cache retention expense evenly across the tasks completed during that hour.

What is the uncached comparison scenario?

It prices all input tokens, including the cached prefix, at the entered uncached-input rate while leaving output and storage unchanged.

Are output tokens affected by prompt caching?

They are usually priced and generated separately, so this calculator applies the output rate to them regardless of cache use.

Does monthly cost include fixed infrastructure?

No. It projects entered per-task model and allocated cache costs only. Add hosting, observability, and other fixed costs separately.

Variables and units

VariableMeaningUnit
U, C, OUncached, cached, and output tokenstokens/task
Pᵤ, P꜀, PₒToken prices by class$/million tokens
SCache storage or retention cost$/hour
HTasks sharing storagetasks/hour
CostFully allocated unit cost$/task

Browse calculator categories

22 category hubs