In this guide
Short answer
Test prompt caching on a repeated Claude API workflow, verify cache hits and compare cost per accepted result before changing production.
Who this is for
This guide is for an application that repeatedly sends the same reference material through the Claude API. It is not a way to change the billing of a consumer Claude chat plan. The exercise uses non-sensitive test content and produces a cost ledger, not a guaranteed saving.
1. Pick a stable task and a baseline
Choose a narrow task such as answering questions about an approved product handbook. Freeze a version of the handbook and write ten questions with expected answers, including two the handbook cannot answer. Run a baseline with caching disabled and record output quality, latency, errors and total charges.
Use the same model and answer criteria in both runs. Otherwise a cheaper total might be caused by a shorter answer or a different model rather than caching. Include a human check for unsupported claims.
2. Keep the reusable prefix identical
The Claude caching documentation supports cache markers such as cache_control: { type: "ephemeral" } on eligible content blocks. Place the marker at the end of stable material and put each changing question afterward. Check the minimum cacheable length for your selected model and platform. The default lifetime is five minutes; an hour option has different write costs.
Our suggested layout is: task rules, versioned handbook, then the incoming question. Keep a timestamp, random request identifier and personalized greeting outside the stable section. Do not pad a short prompt with irrelevant text solely to chase a cache hit.
3. Prove a hit before measuring savings
Send one warm-up request, wait for its response, then send a different question with an unchanged prefix inside the lifetime. Inspect cache_creation_input_tokens, cache_read_input_tokens and input_tokens in response usage. Those three fields together represent total input; input_tokens alone does not. A marked prompt can still produce no cache when too short.
Record actual charges or apply the current model’s write, read, ordinary-input and output rates. A cache reduces repeated input cost; it does not remove output costs or the need to validate answers.
4. Run useful failure tests
Repeat the run after deliberately changing one sentence in the handbook. Repeat again after a long pause. Record the effect rather than assuming every request hits. Try the real traffic pattern: a burst of ten questions and a sparse sequence are different workloads.
Include failed requests and retries in the ledger. If the cache run is faster but creates more unsupported answers, it has not met the original acceptance standard. Investigate prompt changes before scaling.
| Ledger field | Why record it |
|---|---|
| Document version and model | Makes comparisons interpretable |
| Cache writes and reads | Confirms reuse actually occurred |
| Total charge including retries | Captures the paid workflow |
| Accepted answers | Provides the useful denominator |
| Review minutes and latency | Captures work beyond token billing |
5. Decide with an acceptance rule
Calculate total trial cost divided by accepted answers for both runs. As a suggested pilot rule, adopt caching only if answers pass the same checks and savings remain under your typical arrival pattern. Set a small rollout budget and review the ledger after one week. These are proposed evaluation criteria, not DiscoverAI benchmark results.
Continue with model-selection guidance, API cost per accepted result and the Claude profile.
Transparency
How this guide was checked
Editorial accountability
Who checked this guide
- Evaluation type
- Research-based verification
- Last materially checked
- Evidence
- 1 listed sources
Hands-on testing is identified explicitly. Research-based coverage uses cited product documentation and other named sources; it does not imply every paid plan was used. Read the full methodology.
Editorial basis
What this guidance is based on
- Editorial basis
- Source-led analysis
- Primary references
- 1
- Products covered
- 1
- Last checked
- 2026-10-13
Important limits
- • Features, availability, and pricing can change after publication; confirm consequential details with the provider.
Sources and verification
Product details and claims were checked against the following primary sources.
Frequently asked questions
Does this lower a Claude chat subscription price?
No. This exercise concerns API request billing, separate from consumer chat subscriptions.
Does a cache marker prove savings?
No. Confirm hits in usage fields and compare total cost per accepted answer under realistic traffic.
Tools mentioned in this article
Claude
Anthropic's thoughtful, safety-focused AI with exceptional long-form reasoning
Claude excels at deep analysis, long-form writing, and nuanced reasoning. Built by Anthropic with a focus on safety and helpfulness.
Read next

