prompt-caching

Cache prompt prefixes in Messages API requests to reduce latency and cost.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/theslashdojo/dojo --skill prompt-caching-theslashdojo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prompt-caching
Source: https://github.com/theslashdojo/dojo/tree/main/nodes/anthropic/prompt-caching
Command: npx skills add https://github.com/theslashdojo/dojo --skill prompt-caching-theslashdojo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires anthropic, and includes scripts (resource) components.

What problem does it solve?

Prompt caching eliminates repeated reprocessing of identical prompt prefixes so agents spend less time and money on identical system prompts, large documents, or tool definitions sent across multiple API calls.

Core Features & Use Cases

  • Automatic caching: Add a top-level cache control to let the system manage breakpoints and cache writes for multi-turn conversations.
  • Explicit breakpoints: Place cache control on specific content blocks for fine-grained control when different sections change at different rates.
  • Cost and rate-limit savings: Reads are heavily discounted versus writes, and cached tokens typically do not count toward input token rate limits, improving throughput.
  • Use case: Cache a long system prompt and associated tool definitions so subsequent requests read cached tokens and only pay for uncached input.

Quick Start

Use prompt-caching by adding a cache_control directive to your Messages API request and verify cache hits using the usage fields cache_creation_input_tokens, cache_read_input_tokens, and input_tokens.

Frequently Asked Questions about prompt-caching

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cache prompt prefixes to reduce latency and cost in the Anthropic Messages API?

Cache prompt prefixes by adding a cache_control directive to your Messages API request. This allows the system to manage breakpoints and cache writes for identical system prompts, large documents, or tool definitions, reducing subsequent latency and cost.

What is the minimum token threshold for prompt caching with Anthropic?

The minimum cacheable token threshold for prompt caching is model-specific, ranging between 1024 and 4096 tokens. You must satisfy this minimum limit to successfully cache prompt prefixes and achieve cost optimization.

How do I verify cache hits when using prompt caching?

Verify prompt caching hits by checking the usage fields in the API response: cache_creation_input_tokens, cache_read_input_tokens, and input_tokens. These metrics validate that cached tokens are being read successfully.

Can I set explicit breakpoints for caching specific content blocks in multi-turn conversations?

Yes, you can place cache control on specific content blocks to set explicit breakpoints. This provides fine-grained control for multi-turn conversations when different sections of the prompt change at different rates.

What are the TTL options for ephemeral prompt caching and how do they affect cost?

Ephemeral prompt caching supports TTLs of 5 minutes or 1 hour. Choosing a TTL involves higher write costs upfront, but cached reads are heavily discounted and typically do not count toward input token rate limits.