Prompt Caching Token Budget Planner

This planner estimates how many input tokens a prompt-caching design can avoid processing at the standard uncached rate. It separates reusable prefix tokens from request-specific tokens, applies an expected cache-hit rate, and adds output tokens to produce cached and uncached monthly token volumes.

The results support cost and capacity planning for repeated system prompts, tool definitions, large instruction blocks, or shared conversation prefixes. The calculator reports effective input tokens per request, monthly cached tokens, monthly uncached tokens, and total output tokens. It assumes the reusable prefix is eligible for caching and that a cache hit applies to the entire reusable portion. Actual behavior can differ because providers use minimum cacheable lengths, time-to-live rules, prefix matching, write charges, and separate cached-token pricing.

Inputs

requests
tokens
tokens
tokens
%
%
Result
Monthly effective input token budget
Effective uncached-equivalent input per request
Monthly cached input tokens
Monthly uncached input tokens
Monthly output tokens

1. Enter monthly requests
Use the expected number of model calls, including retries when they generate billable tokens.

2. Separate reusable and unique input
Place stable prefixes in reusable tokens and request-specific content in unique tokens.

3. Estimate cache hit rate
Use observed or expected matching after considering cache lifetime, routing, and prefix stability.

4. Add output and safety margin
Reserve for generated tokens and growth or variability in traffic and prompt length.

5. Review token flows
Compare cached and uncached volumes to understand the operational effect of caching.

Adjusted requests = monthly requests × (1 + safety margin) Cached input tokens = adjusted requests × reusable tokens × cache hit rate Uncached input tokens = adjusted requests × [unique tokens + reusable tokens × (1 − hit rate)] Effective uncached-equivalent input per request = unique tokens + reusable tokens × (1 − hit rate) Output tokens = adjusted requests × output tokens per request

This planner counts cached and uncached token volumes but does not apply provider prices. A cache miss sends the reusable prefix through the uncached path.

What the result means

The main result is the monthly input volume that remains on the uncached-equivalent processing path after expected cache hits and safety margin.

Check provider-specific eligibility, cache-write pricing, retention, and minimum prefix rules before using the result in a cost forecast.

Given: 2,000,000 monthly requests, 6,000 reusable tokens, 900 unique input tokens, 500 output tokens, 80% cache hit rate, and 10% safety margin.

Calculation: Adjusted requests = 2,000,000 × 1.10 = 2,200,000. Cached input = 2,200,000 × 6,000 × 0.80 = 10.56 billion tokens. Uncached input per request = 900 + 6,000 × 0.20 = 2,100 tokens. Monthly uncached input = 2,200,000 × 2,100 = 4.62 billion tokens. Output = 2,200,000 × 500 = 1.10 billion tokens.

Result: The effective monthly uncached input budget is 4.62 billion tokens, while 10.56 billion reusable-prefix tokens are served through the cache path.

What counts as a reusable prefix?

It is the stable leading portion of a request that can match a previously cached prefix, such as system instructions or tool schemas. Request-specific text belongs in unique tokens.

How should cache hit rate be estimated?

Use production telemetry when available. Otherwise model a conservative rate based on prefix stability, cache lifetime, routing consistency, and traffic repetition.

Do cached tokens still count toward context length?

Usually they still occupy model context even when billed or processed differently. Caching changes processing economics, not the semantic context sent to the model.

Why include a safety margin?

Request volume and token length vary. A margin provides planning capacity for growth, retries, and longer prompts without changing every base input.

Does this calculator estimate dollar savings?

No. It reports token volumes. Apply provider-specific uncached, cache-write, and cache-read rates in a separate cost calculation.