I wanted to know one thing: if Haiku caches a prompt, can Sonnet use that cache?
What I tested
One Python script, the plain Claude API, no framework. The models are claude-haiku-5-5 and claude-sonnet-5-5. The same long system prompt goes out four times, marked for caching:
- Haiku, first time
- Haiku again
- Sonnet, same prompt
- Haiku again
The prompt starts with a random run id, so every run starts with an empty cache. Each call asks for one word, “OK”.
client.messages.create(
model=model,
max_tokens=1024,
system=[{
"type": "text",
"text": system_prompt,
"cache_control": {"type": "ephemeral"},
}],
messages=[{"role": "user", "content": "Reply with just the word OK."}],
)
The result
The prompt was 3,485 input tokens on both models. 3,469 of them were cached, and 16 were the rest of the request.
| Call | Model | Cache write | Cache read |
|---|---|---|---|
| 1 | Haiku | 3,469 | 0 |
| 2 | Haiku | 0 | 3,469 |
| 3 | Sonnet | 3,469 | 0 |
| 4 | Haiku | 0 | 3,469 |
Call 3 is the answer. Sonnet could not read the cache Haiku wrote, so it wrote its own. Haiku’s cache was not lost: call 4 read it again. The default cache lives 5 minutes, and each hit starts the 5 minutes again. My four calls ran one right after another, so call 4 still found it.
So each model has its own cache. If an app switches models in the middle of a conversation, the new model pays the cache write again.
The docs say the same
The Claude Code prompt caching page has a “Cache scope” section. It says two requests share a cache only when their model, speed and prefix match. My lab tests the model part. By the same rule, turning fast mode on or off also starts a new cache. I did not test fast mode.
This is not a new finding. The claude-model-switch-tax repo on GitHub ran the same Haiku to Sonnet test through Claude Code. I wanted to see it on the plain API with my own numbers.
The trap I hit first
My first run cached nothing. I had left the prompt at 3 lines, 176 tokens. That is under the 512-token minimum for both 5.5 models. The minimum is not the same for every model: Sonnet 5 needs 1,024 tokens and Haiku 4.5 needs 4,096. On Haiku 4.5, even my 3,485-token prompt would not cache.
All four calls came back with cache write 0 and cache read 0. Every reply was “OK”. There was no error and no warning.
That is the part I will remember. A cache mark in the request does not mean anything was cached. The only proof is in the usage fields: cache_creation_input_tokens and cache_read_input_tokens. Check them on every call.