Prompt caching - Anthropic
Prompt caching is a powerful feature that optimizes your API usage by allowing resuming from specific prefixes in your prompts. This approach significantly reduces processing time and costs for repetitive tasks or prompts with consistent elements. Here’s an example of how to implement prompt caching with the Messages API using a cache_control block: In this example, the entire text of “Pride and Prejudice” is cached using the cache_control parameter. This enables reuse of this large text across multiple API calls without reprocessing it each time. Changing only the user message allows you to ask various questions about the book while utilizing the cached content, leading to faster responses and improved efficiency. When you send a request with prompt caching enabled: This is especially useful for: By default, the cache has a 5-minute lifetime. The cache is refreshed for no additional cost each time the cached content is used. Prompt caching caches the full prefix Prompt caching referen
Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading...
Explore this link on the map →related reading
- GitHub - brexhq/prompt-engineering: Tips and tricks for working with Large Language Models like OpenAI's GPT-4. · GitHubgithub.com
- Perplexityperplexity.ai
- GitHub - x1xhlol/system-prompts-and-models-of-ai-tools: FULL Augment Code, Claude Code, Cluely, CodeBuddy, Comet, Cursor, Devin AI, Junie, Kiro, Leap.new, Lovable, Manus, NotionAI, Orchids.app, Perplexity, Poke, Qoder, Replit, Same.dev, Tragithub.com
- GitHub - f/prompts.chat: f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy. · GitHubgithub.com
- ChatGPTchatgpt.com
- The Shape of AI | UX Patterns for Artificial Intelligence Designshapeof.ai
- GitHub - agno-agi/agno: Build, run, and manage agent platforms. · GitHubgithub.com
- OpenAI | Research & Deploymentopenai.com
- GitHub - affaan-m/ECC: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. · GitHubgithub.com
- Rewind.ai - Every AI Tool, Completely Freerewind.ai
- Cookbookcookbook.openai.com
- GitHub - 0xk1h0/ChatGPT_DAN: ChatGPT DAN, Jailbreaks prompt · GitHubgithub.com