AM.
Back to Overview

Designing a Prompt Cache Cost Check Around Request Arrivals

Mandate & Focus

Design study · Fictional enterprise assistant · Independent Design study

By Design study

Fictional arrivals and normalized prices. Six cache totals reproduced offline. Actual cache usage and billed service costs require operational evidence.

Design feature 01

3 fictional patterns

Design feature 02

2 cache lifetimes

Design feature 03

6 reproduced totals

Executive Summary

Three fictional request patterns compare two cache lifetimes, with an offline verifier and explicit normalized prices.

Architectural Deep Dive

Design study. A fictional enterprise team is planning an assistant that answers questions against a versioned internal manual. Finance wants to compare ordinary prefix processing with two possible cache lifetimes. The team has four planned questions per example but has not measured production traffic. This study holds the prefix size and request count fixed, then changes the arrival gaps and prefix identity.

Keep the comparison small enough to inspect

The proposed fixture has one normalized unit for processing the stable prefix at the ordinary input rate. It assumes a short lifetime of five minutes with a write price of 1.25 units, and a long lifetime of sixty minutes with a write price of two units. A read costs 0.10 units under either candidate. These are invented planning parameters. They are stored in the fixture so readers can change them without treating them as a current quotation for a particular model.

The relevant service distinctions come from Anthropic’s caching documentation, which describes reusable prefixes, cache lifetimes and returned creation/read usage. Its pricing documentation supplies separate token categories and prices for actual planning. The local example implements only the explicitly declared toy rules. Choosing a real model, platform and tariff would be a separate part of the team’s rehearsal.

Make the expiry convention explicit

Each event supplies an arrival minute and a prefix label. The local model starts empty. A request before the stored expiry reads the entry. A request at or after expiry writes a new one. Either event sets the expiry to its arrival plus the chosen lifetime. The example assumes zero write duration and enough cache capacity to retain every prefix until expiry. It has no network, provider connection or tokenization step.

This convention makes the toy deterministic. It also tells the reviewer which questions require operational evidence. Requests arriving while a write is still being created are outside its scope. A real request trace would need completion times and returned token usage to determine which portions were created or read. Prefix labels in the file stand for fixed content, with each label assumed to have the same token length.

Compare the three demand patterns

The burst pattern sends one prefix at minutes zero, two, four and twelve. The short candidate produces two writes and two reads for 2.70 units. The long candidate produces one write and three reads for 2.30 units. Ordinary prefix processing would total four units. Within this invented pattern, the longer lifetime pays for its larger creation cost by avoiding the final short-lived entry’s rewrite.

The spaced pattern sends one prefix at minutes zero, six, twelve and eighteen. Four short writes total five units. The long candidate again uses one write and three reads for 2.30 units. This is a useful counterexample for a worksheet that substitutes the read price for all input. The request count is unchanged, but the short candidate becomes more expensive than ordinary processing.

The changing-prefix pattern uses four separate labels at those same spaced times. Both candidates write every time. The short candidate costs five units and the long candidate costs eight units. The longer retention has no reuse to reward in this constructed sample. A real team would need to investigate whether the changing prefixes reflect necessary task evidence or an avoidable request-construction choice.

Preserve the arithmetic and the limits together

The fictional arrival fixture and offline verifier reproduce all six cache totals with exact rational arithmetic. The guide records the expiry boundary, immediate-write assumption and excluded costs. They can be saved together and run with Python’s standard library.

The verifier checks declared examples rather than estimating a population average. The equal prefix sizes make the comparison easy to audit. A subsequent exercise should vary both prefix length and the changing suffix, and preserve billed categories by attempt. Where access permits, compare the modelled classifications against the provider’s returned categories before using the model for a budget. A discrepancy would be evidence to revise an assumption.

Give finance a decision it can revisit

The proposed handoff would contain the request-pattern sample, source of its timestamps, prefix-version definitions, rate revision and category totals. Finance could then see which assumptions control the estimate and request a different scenario. The team would also retain output-token costs, variable input, retries and task acceptance results in the wider service budget.

The companion essay explains the break-even arithmetic, and the inference cost calculator supports broader two-rate planning. This study establishes six reproducible totals for fictional arrivals. Moving it into a service decision requires authorised request evidence, actual cache usage, complete charges and evaluation of the answers people receive.

Proposed approach

Scope
Equal prefix sizes and sequential arrivals
Evidence
Invented prices and offline rational arithmetic

Sources

  1. Prompt caching — Anthropic documentation, checked 18 November 2026
  2. Pricing — Anthropic documentation, checked 18 November 2026

Related reading

Read the publishing standards or suggest a correction.

Technical FAQ

What was executed?
A local Python verifier classified fictional request arrivals and checked six exact arithmetic totals.
What happens at expiry in this model?
An arrival at or after the stored expiry creates a new entry. Writes are assumed immediately available and each hit refreshes the lifetime.
Does the example include the entire AI service bill?
It compares only equal-length stable prefixes. Variable input, output, retries, tools and other charges require separate accounting.

Ready to architect operational leverage?

Available for fractional executive leadership, enterprise architecture consulting, and board-level technical advisory.

Initiate Dialogue ↗