> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ruapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude auto-caching: cache prices without setting cache_control

> RuAPI automatically adds cache_control markers to Claude requests that have none, so re-sent context in a continuing conversation is billed at the cache price. On Nov 18–20, 2026, about 90% of the input tokens in requests RuAPI marked were read from the cache.

RuAPI auto-caching adds `cache_control` markers to Claude requests that have none, so when turns come less than 5 minutes apart, re-sent context is billed at the cache-read price: on Claude Sonnet 5.5 that's 1/20 of regular input. There's nothing to configure. Don't confuse it with Anthropic's "automatic caching", where the client itself puts one `cache_control` marker at the top level of the request; RuAPI auto-caching mainly kicks in when the client sets no markers at all.

Why this matters: with Claude, prompt caching is switched on by the client — Anthropic only bills re-sent content at the cache price when the request carries a `cache_control` marker. Claude Code and many other tools that use the native Anthropic format set the markers themselves. But many tools that call Claude in the OpenAI-compatible format set no markers, so with every new turn the whole conversation history is billed again at full price.

## What a Claude conversation costs with and without the cache

A coding tool re-sends the whole conversation on every turn: the system prompt, file contents, earlier answers and tool results. The longer the conversation, the more input tokens on each turn.

A rough estimate: a 30-turn conversation with Claude Sonnet 5.5, with the context growing gradually from 20K to 100K tokens and less than 5 minutes between turns. Prices are from the [pricing page](https://www.ruapi.ai/pricing?lng=en\&utm_source=docs\&utm_campaign=en-claude-auto-cache) as of Nov 20, 2026; the price on your account may be lower.

| | Input cost over 30 turns |
| - | - |
| No cache (input \$2.40 per 1M tokens) | about \$4.30 |
| With auto-caching (read \$0.12, write \$3.00 per 1M tokens; first turn at full price) | about \$0.55 |

On Sonnet 5.5 a cache read costs 1/20 of regular input; a write costs 25% more than regular input but pays off with the very first read on the next turn. On Opus 5.5 and Fable 5.2 a cache read is \$0.24 per 1M tokens — 1/20 and 1/40 of regular input respectively.

## Why the OpenAI-compatible format often gets no caching

* Anthropic's own OpenAI-compatible layer doesn't support prompt caching ([Anthropic docs](https://docs.anthropic.com/en/api/openai-sdk), checked Oct 15, 2026).
* Many coding tools and home-grown agents don't send `cache_control` when the "OpenAI Compatible" provider is selected. For Cline we checked this in the source code (Oct 16, 2026). Without markers, caching doesn't happen even if the gateway supports it.
* Our own data shows the same: in the 30 days before auto-caching launched on Nov 4, 2026, not a single Claude request in the OpenAI format read anything from the cache.

## How RuAPI adds cache markers automatically

If the client set no markers at all, RuAPI adds at most two for you, with a 5-minute cache:

1. **System prompt (together with tool definitions)** — when the exact same ones came with the same key to the same model in the last 5 minutes. That way the system prompt can be read from the cache even on the first turn of a new conversation and in a series of standalone requests (for example, batch processing).
2. **The last user message or tool result** — when the conversation is continuing and, as a rule, the previous turn came within the last 5 minutes. The whole history then goes into the cache.

If 3 cache writes in a row don't pay off, auto-caching pauses — usually for 1 hour and only for that conversation or system prompt. There are also two overall safeguards per key and model: one on money lost to writes and one on earlier history being rewritten. If the client sets markers itself, its markers are used; RuAPI adds one at the end only if the client set 1–2 markers far from the end of the conversation, a large chunk after them isn't cached, and the conversation is continuing within 5 minutes.

This works in both formats: OpenAI-compatible (`/v1/chat/completions`) and native (`/v1/messages`). The full rules are in [Prompt caching](https://docs.ruapi.ai/en/prompt-caching.md#ruapi-auto-caching).

## What auto-caching saves in practice

From the launch of the new auto-caching version on the evening of Nov 18, 2026 to the morning of Nov 20, 2026:

* in Claude requests where RuAPI added the markers, about 90% of the input tokens were read from the cache. That's a share of tokens: a cache write costs 25% more than input, so the share saved in money is somewhat lower. Requests RuAPI didn't mark (for example, a turn after a long break) aren't included in this figure;
* the longer the conversation and the fewer breaks longer than 5 minutes, the bigger the saving.

## Where to see your savings

* **Console home page**: once you've saved something over the last 7 days, a "Prompt cache saved you" card appears on the home page with the amounts for today and the last 7 days (refreshed about every 5 minutes).
* **Usage Logs**: open an entry — the "Saved by cache" line shows how much cheaper this request was than without the cache (it appears only when there actually was a saving); "Cache Tokens" is how much was read from the cache.
* **API response**: in the OpenAI format, `usage.prompt_tokens_details.cached_tokens`; in the Anthropic format, `usage.cache_read_input_tokens`.

## When it's still better to set markers yourself

* **Long gaps between turns are common**: set the markers yourself and use the one-hour cache (`"ttl": "1h"`; a write costs twice the regular input price).
* **Your own code**: in the OpenAI-compatible format a single top-level `cache_control` marker is enough — RuAPI, like Anthropic's native API, moves it onto the last message.
* **If a coding tool lets you pick the Anthropic provider, pick it**: in the native format the tool manages caching itself, which is the most reliable option.

Code examples are in [Prompt caching](https://docs.ruapi.ai/en/prompt-caching.md).

## How this differs from OpenRouter

According to OpenRouter's documentation, Claude caching requires the client to set `cache_control` markers: one at the top level of the request (on the Claude providers its docs list) or up to four on content blocks. The documentation doesn't say that OpenRouter adds markers itself when the client sets none.

| | RuAPI | OpenRouter |
| - | - | - |
| Request without markers from the client | Markers are added automatically, billed at the cache price | The client has to set markers (the docs don't mention adding them automatically) |
| Client sets its own markers | The client's markers are used; if they're far from the end, one is added | The client's markers are used |

The information about OpenRouter is from its [official documentation](https://openrouter.ai/docs/features/prompt-caching) (checked Nov 20, 2026).

## FAQ

> [accordion] Do I need to turn auto-caching on?
>
> No, auto-caching works for every key.

> [accordion] Can auto-caching end up costing more?
>
> A cache write costs 25% more than regular input, so RuAPI only adds a marker when the cache is likely to be read. If writes repeatedly fail to pay off, auto-caching pauses itself.

> [accordion] Do GPT and DeepSeek need auto-caching?
>
> No. Their caching kicks in by itself: if a long enough prefix of the request matches the previous one, it's usually read from the cache.

> [accordion] Does auto-caching affect Claude Code?
>
> No. Claude Code puts a marker on the latest message itself, and RuAPI adds nothing.

> [accordion] Why didn't auto-caching kick in?
>
> Common reasons:
>
> * there were no requests for more than 5 minutes and the cache expired;
> * it's the first turn of a new conversation: only a system prompt and tools identical to ones sent in the last 5 minutes are read from the cache;
> * the client changes earlier content each turn — for example, it adds the current time to the system prompt;
> * several writes in a row didn't pay off, and auto-caching is paused;
> * the request is too short: below the model's minimum cacheable length.

## Next steps

* [Prompt caching](https://docs.ruapi.ai/en/prompt-caching.md): the full rules and code examples.
* [How to cut your Claude Code and Cline bill](https://docs.ruapi.ai/en/claude-code-cline-costs.md): what breaks the cache.
* [OpenAI or Anthropic format](https://docs.ruapi.ai/en/openai-vs-anthropic-format.md): how the two formats differ.
* [Pricing](https://docs.ruapi.ai/en/pricing.md): input, output and cache prices for every model.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.