Amazon Bedrock Prompt Caching and Token Accounting
Prompt caching is one of the most testable ways to cut cost and latency. These notes cover what to cache, how checkpoints and the TTL behave, why a cache miss happens and how the token counts in the response add up.
Key points (3)
Prompt caching · Cache the static prefix
Prompt caching reuses a long, repeated prompt prefix to cut latency and input token cost, so put static content first and dynamic content last. Cache checkpoints need a model-specific minimum (512 to 4,096 tokens) and the default 5-minute TTL resets on every hit.
Cache checkpoints are processed in the order tools, system, messages, and changing an earlier section invalidates the later ones. Any change to the cached prefix is a cache miss; check cacheReadInputTokens and cacheWriteInputTokens in the response.
With caching on, inputTokens only counts non-cached tokens. Total input tokens = inputTokens + cacheReadInputTokens + cacheWriteInputTokens. Cached reads are billed at the cache-read rate, and prompt caching is not supported with batch inference.