Prompt Caching Cost per Task Calculator

The Prompt Caching Cost per Task Calculator estimates the blended serving cost of one task when some prompts are cache hits and others are cache misses. It combines input-token, output-token, and optional fixed infrastructure costs using the expected hit rate.

Use the result to compare caching policies, price a feature, or forecast workload spend. Provider billing rules differ, so the token prices and cache discount entered should match the actual service contract.

Calculator inputs

tokens
tokens
USD
USD
%
%
USD
Result
Blended cost per task
Cache-hit task cost
Cache-miss task cost
Cost per 1,000 tasks

1. Enter task token usage
Use average billable input and output tokens for one completed task.

2. Add current token prices
Enter prices per one million tokens for the selected model or provider.

3. Describe caching
Provide the expected hit rate and discount applied to cached input tokens.

4. Include non-token expense
Optionally add a fixed per-task amount for infrastructure or orchestration.

5. Review blended cost
Use the per-task and per-1,000-task figures for budgeting.

Miss cost = Input tokens × Input price ÷ 1,000,000 + Output tokens × Output price ÷ 1,000,000 + Other cost
Hit cost = Cached input cost after discount + Output cost + Other cost
Blended cost = Hit rate × Hit cost + (1 − Hit rate) × Miss cost

What the result means

The main result is the expected average cost for one task across the entered mix of hits and misses.

The estimate excludes taxes, minimum commitments, tiered pricing, and provider-specific cache write charges unless added to other cost.

Given: 3,000 input tokens at $3 per million, 500 output tokens at $15 per million, 80% hit rate, 75% cached-input discount, and $0.002 other cost.

Calculation: Miss cost = $0.009 + $0.0075 + $0.002 = $0.0185. Hit cost = $0.00225 + $0.0075 + $0.002 = $0.01175. Blended cost = 0.80 × $0.01175 + 0.20 × $0.0185 = $0.01310.

Result: About $0.0131 per task, or $13.10 per 1,000 tasks.

Does the discount apply to output tokens?

Not in this model. The cache discount is applied only to input-token cost.

Should cache-write charges be included?

Yes, when the provider bills them. Add their average per-task amount to the other cost field.

Can token prices use another currency?

The math works with any currency if every cost input uses the same currency, though the display is labeled USD.

Why is the hit cost not zero?

Output generation, discounted input processing, and other infrastructure can still create cost on a cache hit.

How can I forecast monthly spend?

Multiply the blended cost by expected monthly task volume, using separate scenarios if traffic or hit rate varies.