Prompt caching in Claude works by storing the computational work done on messages so it can be reused in follow-up requests. This makes subsequent requests both cheaper and faster to execute, but only when you're repeatedly sending the same content.

The process follows a two-phase pattern: the initial request writes to the cache, and follow-up requests can read from it. The cache only lives for 5 minutes, so this feature is most useful when you're sending the same content repeatedly within a short timeframe.
Cache Points
Prompt caching isn't enabled automatically - you need to manually add cache point message parts to control what gets cached. Cache points tell Claude to cache all the work done for everything before that point in your message.

Here's how you add a cache point to a user message:
user_message = {
"role": "user",
"content": [
{"text": "Summarize this long text: ..."},
{"cachePoint": {"type": "default"}}
]
}The key rule is that work done for everything before the cache point will be cached, but anything after the cache point won't be stored in the cache.
How Cache Points Work

When you make an initial request with a cache point, Claude processes all the content and stores the work done up to that cache point. On follow-up requests, if the content before the cache point is identical, Claude reads the previously processed work from cache instead of reprocessing it.

The cache will only be used if the content before the cache point is completely identical. Even small changes like adding "Please" to the beginning of your prompt will prevent cache usage, forcing Claude to process everything from scratch.

Caching Across Messages
Cache points can span multiple messages and even include assistant messages. This means you can cache entire conversation histories up to a certain point.

For example, you might have a conversation with a user message, assistant response, and another user message, with a cache point at the end. All the processing work for that entire conversation thread gets cached and can be reused.
Minimum Content Length
There's a minimum length for caching, and it depends on the model. For Claude Haiku 4.5, the model this course uses, content must be at least 4,096 tokens long to be cached. This is the sum of all messages and parts you're trying to cache before the cache point.
A message like "Hi there!" is far too short to be cached, but a long prompt reaches the minimum. Content under the minimum is processed without caching, and the request still succeeds.
Cache Point Locations
Cache points aren't restricted to user messages. You can add them to system prompts and tool definitions, which are actually the most common caching opportunities.

For tool definitions:
tools = [
{"toolSpec": add_duration_to_datetime_schema},
{"toolSpec": get_current_datetime_schema},
{"cachePoint": {"type": "default"}}
]For system prompts:
system = [
{"text": "You are a senior software..."},
{"cachePoint": {"type": "default"}}
]These are the most valuable caching opportunities because system prompts and tool lists rarely change between requests, making them perfect candidates for caching.