VanaAPI

← Writing

Reading the cache lines after a Claude request

Money mattersEN2026-10-27

A Claude request can contain material you send repeatedly: project instructions, a reference document, or a long description of your application. Prompt caching lets the service reuse an eligible, previously processed beginning of that request. The useful distinction is simple: a cache write prepares context for reuse; a cache read reuses it on a later request.

This is not a saved-answer feature. Claude still generates a new response. The cache concerns input processing, not a promise to repeat the previous answer.

§ The part of the prompt that stays still

Imagine an assistant that answers questions about an internal handbook. Every request includes the same handbook, followed by a different question. Without a cache hit, the repeated material is processed again as ordinary input.

For caching, arrange the request with stable material first and changing material afterward. Claude caches a prefix: the beginning of the prompt up to a designated boundary. In the Anthropic Messages format, that prefix can include tool definitions, system content, and messages, in that order.

Changing something near the beginning can prevent reuse of everything that follows it. A fresh timestamp placed before the handbook is therefore a poor neighbor for reusable context.

§ A cache marker, line by line

In an Anthropic Messages request, an explicit cache boundary can be attached to an eligible content block. Here is a system-content example, shown as individual lines:

Line 1: "system": [

Line 2: {"type": "text",

Line 3: "text": "Your stable instructions and complete handbook go here.",

Line 4: "cache_control": {"type": "ephemeral"}}

Line 5: ]

The first line starts the system-content array. The second identifies a text block. The third holds the actual reusable material; replace the placeholder with your full content. The fourth marks the end of the prefix you want cached. The fifth closes the array. Your changing question belongs later, in the messages section.

This is a request fragment, not a complete request. A marker also does not guarantee a write: the prefix must meet the selected model’s minimum cacheable length and other eligibility requirements.

§ The first response: a cache write

Suppose an eligible request produces these illustrative usage fields:

  • input_tokens: 100 — ordinary input tokens that were neither read from nor written to the cache.
  • cache_creation_input_tokens: 2000 — input tokens processed to create a cache entry.
  • cache_read_input_tokens: 0 — no input tokens reused from an existing entry.

In this example, total input is 2,100 tokens: add all three fields. In native Anthropic usage, the ordinary input_tokens field does not already include the two cache categories. Output tokens are counted separately.

A cache write is not free storage. It is a billable input category, and its rate can differ from ordinary input. Check the applicable rates rather than treating every input token as equally priced.

§ The next response: a cache read

Send the same eligible prefix again while the entry remains available, with a new question after the boundary. An illustrative result is:

  • input_tokens: 100 — the uncached portion of this request.
  • cache_creation_input_tokens: 0 — no new cached prefix was created.
  • cache_read_input_tokens: 2000 — the repeated prefix was reused.

The total input is still 2,100 tokens, but its billing categories changed. Cache reads are generally cheaper than ordinary input. They can also reduce input-processing time, though response length and other factors still affect overall latency.

§ Checking a real session

Claude’s standard ephemeral cache lifetime is five minutes, refreshed by a cache hit. A longer one-hour option exists where supported. Do not assume an entry survives indefinitely, or that requests sent simultaneously will all benefit before the first write completes.

Vana API offers an OpenAI-compatible endpoint at https://api.vanaapi.com and also supports the Anthropic Messages protocol. Use the latter when working with the native cache fields described here; OpenAI-compatible usage reporting may have a different shape. Vana API bills per real token with no monthly fee, so inspect both usage categories and applicable rates when estimating savings.

Create a Vana API account, then test two sequential requests with identical stable context. Read the write line first, then the read line. Those two responses are a clearer starting point than assuming a cache marker alone means a discount.