View a markdown version of this page

Prompt caching for faster model inference - Amazon Bedrock

Prompt caching for faster model inference

Prompt caching is an optional feature that you can use with supported models on Amazon Bedrock to reduce inference response latency and input token costs. Amazon Bedrock supports two types of prompt caching: Implicit Prompt Caching and Explicit Prompt Caching. Support for each type varies by model and API.

Prompt caching can help when you have workloads with long and repeated contexts that are frequently reused for multiple queries. For example, if you have a chatbot where users can upload documents and ask questions about them, it can be time consuming for the model to process the document every time the user provides input. With prompt caching, you can cache the document so that future queries containing the document don't need to reprocess it.

Types of prompt caching

The two types differ in how reusable prompt content is selected:

Type How it works Request configuration
Implicit Prompt Caching Amazon Bedrock and the model automatically attempt to reuse eligible prompt prefixes. No cache controls or breakpoints are required in your request.
Explicit Prompt Caching You identify reusable prompt prefixes by adding model-specific cache controls or breakpoints. Your request must include the cache controls supported by the model and API.

Implicit Prompt Caching

Implicit Prompt Caching automatically attempts to reuse eligible prompt prefixes without requiring cache controls in your request. Keep static content at the beginning of your prompt and dynamic content at the end to increase the likelihood of an exact prefix match.

Implicit Prompt Caching is best effort. Repeating an identical prompt doesn't guarantee a cache hit, and cache-hit rates can vary.

Explicit Prompt Caching

Explicit Prompt Caching lets you identify reusable prompt prefixes using model-specific cache controls or cache checkpoints. Cache checkpoints are markers that define the contiguous subsection of your prompt that you want to cache. Prompt prefixes should remain static between requests. Changes to a prompt prefix in subsequent requests result in cache misses.

Cache checkpoints have a minimum and maximum number of tokens, depending on the model. You can only create a cache checkpoint if your total prompt prefix meets the minimum number of tokens. Minimums currently range from 512 to 4,096 tokens per cache checkpoint. For the minimum that applies to your model, see Supported models, Regions, and explicit caching limits or the model's model card. The minimum applies cumulatively to the entire prompt prefix before each checkpoint, including, where applicable, content in the tools, system, and messages fields. There is no minimum number of tokens required between cache checkpoints. For a model with a 1,024-token minimum, you can define additional checkpoints fewer than 1,024 tokens apart as long as the total prompt prefix before each checkpoint contains at least 1,024 tokens. If you add a cache checkpoint before the total prompt prefix meets the minimum number of tokens, your inference still succeeds, but your prefix isn't cached.

The cache has a Time To Live (TTL), which resets with each successful cache hit. During this period, the context in the cache is preserved. If no cache hits occur within the TTL window, your cache expires. Many models support a 5-minute TTL. Check the model card for your model to see the exact TTL conditions.

Explicit Prompt Caching provides control over which prompt content is eligible for caching. It doesn't guarantee that an eligible request results in a cache hit.

Billing for cached tokens

For both Implicit Prompt Caching and Explicit Prompt Caching, tokens successfully read from cache are reported as cached tokens and billed at the model's cache-read rate. Tokens that aren't read from cache are billed at the standard input token rate. Depending on the model, tokens written to cache can be billed at a rate that is higher than the standard input token rate. For more information, see the Amazon Bedrock pricing page.

Important

Support for prompt caching doesn't guarantee a cache hit for any request. Check the cache usage fields in the model response to determine whether tokens were read from or written to cache.

You can use prompt caching when you run inference in Amazon Bedrock with supported models. Availability of each prompt caching type varies by model and API. Prompt caching is available through the following Amazon Bedrock features:

Converse and ConverseStream APIs

You can carry on a conversation with a supported model. For Explicit Prompt Caching, specify cache checkpoints in your prompts.

InvokeModel and InvokeModelWithResponseStream APIs

You can submit single-prompt requests to supported models. For Explicit Prompt Caching, enable prompt caching and specify your cache checkpoints.

Prompt Caching with Cross-region Inference

Prompt caching can be used in conjunction with cross region inference. Cross-region inference automatically selects the optimal AWS Region within your geography to serve your inference request, thereby maximizing available resources and model availability. At times of high demand, these optimizations may lead to increased cache writes.

Amazon Bedrock Prompt management

When you create or modify a prompt, you can choose to enable prompt caching. Depending on the model, you can cache system prompts, system instructions, and messages (user and assistant). You can also choose to disable prompt caching.

Note

Prompt caching is only supported for on-demand inference endpoints. It is not supported with the batch inference API.

For models that support Explicit Prompt Caching, the APIs provide granular control over the prompt cache. You can set individual cache checkpoints within your prompts and add checkpoints up to the maximum allowed for the model. For more information, see Supported models, Regions, and explicit caching limits.

Supported models, Regions, and explicit caching limits

Prompt caching support varies by model and API. Model cards identify whether a model supports Implicit Prompt Caching, Explicit Prompt Caching, or both. Prompt caching is available in all AWS Regions where the supported models are available. To check model availability by Region, see Regional availability by models.

The following table lists models that support Explicit Prompt Caching, along with their token minimums, maximum number of cache checkpoints, and fields that allow cache checkpoints.

To see which prompt caching types a model supports, refer to Models at a glance, and then choose the model that you're interested in.

Model name Model ID Release Type Minimum number of tokens per cache checkpoint Maximum number of cache checkpoints or writes per request Supported TTL Fields that accept prompt cache checkpoints

Claude Haiku 5.5

anthropic.claude-haiku-5-5

Generally Available

512

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Sonnet 5.5

anthropic.claude-sonnet-5-5

Generally Available

512

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Opus 5.5

anthropic.claude-opus-5-5

Generally Available

512

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Fable 5.1

anthropic.claude-fable-5-1

Generally Available

512

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Mythos 5.1

anthropic.claude-mythos-5-1

Gated

512

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Fable 5

anthropic.claude-fable-5

Generally Available

512

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Mythos 5

anthropic.claude-mythos-5

Gated

512

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Opus 5

anthropic.claude-opus-5

Generally Available

512

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Opus 4.8

anthropic.claude-opus-4-8

Generally Available

1,024

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Opus 4.7

anthropic.claude-opus-4-7

Generally Available

4,096

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Opus 4.6

anthropic.claude-opus-4-6-v1

Generally Available

4,096

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Opus 4.5

anthropic.claude-opus-4-5-20251101-v1:0

Generally Available

4,096

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Sonnet 5

anthropic.claude-sonnet-5

Generally Available

1,024

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Sonnet 4.6

anthropic.claude-sonnet-4-6

Generally Available

1,024

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude Sonnet 4.5

anthropic.claude-sonnet-4-5-20250929-v1:0

Generally Available

1,024

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

Claude 3.7 Sonnet

anthropic.claude-3-7-sonnet-20250219-v1:0

Generally Available

1,024

4

5 minutes

`system`, `messages`, and `tools`

Claude 3.5 Sonnet v2

anthropic.claude-3-5-sonnet-20241022-v2:0

Preview

1,024

4

5 minutes

`system`, `messages`, and `tools`

Claude Haiku 4.5

anthropic.claude-haiku-4-5-20251001-v1:0

Generally Available

4,096

4

5 minutes, 1 hour

`system`, `messages`, and `tools`

GPT-6.1 Sol

openai.gpt-6.1-sol

Generally Available

1,024

4 cache writes

30 minutes

prompt_cache_breakpoint on input_text blocks (Responses API) and text content parts (Chat Completions and InvokeModel). Converse doesn't support explicit caching for this model.

GPT-5.6 Sol

openai.gpt-5.6-sol

Generally Available

1,024

4 cache writes

30 minutes

prompt_cache_breakpoint on input_text, input_image, and input_file blocks (Responses API)

GPT-5.6 Terra

openai.gpt-5.6-terra

Generally Available

1,024

4 cache writes

30 minutes

prompt_cache_breakpoint on input_text, input_image, and input_file blocks (Responses API)

GPT-5.6 Luna

openai.gpt-5.6-luna

Generally Available

1,024

4 cache writes

30 minutes

prompt_cache_breakpoint on input_text, input_image, and input_file blocks (Responses API)

Nova 2 Lite

amazon.nova-2-lite-v1:0

Generally Available

1K*

4

5 minutes

system and messages

Amazon Nova Pro

amazon.nova-pro-v1:0

Generally Available

1K*

4

5 minutes

system and messages

Amazon Nova Lite

amazon.nova-lite-v1:0

Generally Available

1K*

4

5 minutes

system and messages

Amazon Nova Micro

amazon.nova-micro-v1:0

Generally Available

1K*

4

5 minutes

system and messages

* Amazon Nova models support a maximum of 20K tokens for prompt caching. Prompt caching is primarily for text prompts.