Optimizing Cost and Latency with Amazon Bedrock Prompt Caching
Guide

Optimizing Cost and Latency with Amazon Bedrock Prompt Caching

Best practices, pricing, and Converse API implementation patterns to reduce token costs and latency

3 min read
Based on original reporting byAWS Machine LearningTranslated and summarized by our AI-assisted news systemHow we work

Executive summary

Key Takeaways

  • Prompt caching in Amazon Bedrock can reduce input token costs by up to 90 percent on cache hits and shorten TTFT.

  • Anthropic Claude Sonnet 4.5 and 4.6 models require a minimum threshold of 1,024 tokens to activate caching, while Opus models require 4,096 tokens.

  • The cachePoint syntax in the Converse API is uniform across different model families such as Claude and Amazon Nova.

  • Tenant isolation in multi-tenant systems is implemented using a SHA-256 hash prefix with an overhead of only approximately 16 tokens.

Optimizing Cost and Latency with Amazon Bedrock Prompt Caching

  • Prompt caching in Amazon Bedrock can reduce input token costs by up to 90 percent...
  • Anthropic Claude Sonnet 4.5 and 4.6 models require a minimum threshold of 1,024 tokens to...
  • The cachePoint syntax in the Converse API is uniform across different model families such as...
  • Tenant isolation in multi-tenant systems is implemented using a SHA-256 hash prefix with an overhead...

In a post published by Daniel Abib, Specialist Solutions Architect for Generative AI at AWS, it is explained how using the prompt caching mechanism in Amazon Bedrock can reduce input token costs by up to 90 percent when repeatedly sending the same context to foundation models, as well as shorten time-to-first-token (TTFT). According to the post, without caching, sending a 10,000-token contract alongside 50 different user questions results in billing for 500,000 input tokens at full price for content the model has already processed.

The author notes that alternative approaches for managing costs include shortening prompts (which might compromise context quality), reducing context windows (which degrades the model's ability to reason over complete information), and response caching (which provides no benefit when the same context is paired with different questions). Caching prompts at the infrastructure level enables the model to read cached tokens instead of reprocessing them, without altering the model or prompt quality.

How Prompt Caching Works and Its Pricing

When a request to the Converse API includes a cachePoint marker, Amazon Bedrock evaluates whether the content preceding that marker matches an existing cache entry. In the case of a cache hit, the model skips reprocessing and begins generating output from the cached state. In the event of a cache miss, the model processes the full content and writes the result to the cache for potential future requests.

Four core principles define cache behavior:

  1. Cache scope: Cache entries are scoped strictly to individual AWS accounts and specific AWS Regions.
  2. Minimum token thresholds: Each checkpoint must meet a minimum token threshold to activate caching. For example, Anthropic Claude Sonnet 4.5 and Sonnet 4.6 require at least 1,024 tokens per checkpoint, while Opus models require at least 4,096 tokens.
  3. Time-to-live (TTL): Cache entries expire according to the TTL specified in the request. The default is 5 minutes, with select models supporting up to 1 hour.
  4. Model-agnostic syntax: The cachePoint syntax in the Converse API is identical across supported model families, including Anthropic Claude and Amazon Nova.

In terms of pricing, two new token categories are introduced:

  • cacheWriteInputTokens: Tokens written to the cache on the first request, billed at a cost 25 percent higher than standard input. When utilizing a 1-hour TTL, the cost is 100 percent higher (2x) than standard input.
  • cacheReadInputTokens: Tokens read from the cache on subsequent requests, billed at a cost 90 percent lower than standard input.

For workloads with repeated context, total savings on input token costs reach approximately 75 percent (for instance, a 10,000-token document queried with 10 different questions within the TTL window).

Converse API Use Cases

The post outlines six practical implementation scenarios in Python code using the Converse API:

  1. Message content and long document caching: Placing a cachePoint marker after static document content and before the dynamic user question. In RAG or codebase analysis workflows, Amazon Bedrock caches the document on the first call and might reuse it on subsequent calls. For Claude models, simplified cache management is supported, where a single checkpoint checks for matches across up to approximately 20 preceding content blocks.
  2. System prompt caching: Persona definitions, detailed instructions, and embedded knowledge bases within the system prompt are preserved by placing a cachePoint inside the system parameter, separate from user messages.
  3. Tool definition caching: In agentic workflows, numerous JSON tool schemas can comprise thousands of tokens. Appending a cachePoint at the end of the tool array within toolConfig enables reuse without reprocessing schemas on every conversation turn.
  4. Mixed TTL caching: Assigning different expiration times to different content tiers within the same request—such as 1 hour for reference materials and tool definitions, and 5 minutes for momentary conversation context. The API enforces an ordering constraint where longer TTL checkpoints must appear before shorter TTL checkpoints.
  5. Tenant isolation in multi-tenant systems: To prevent cross-tenant cache access within the same AWS account and Region, a SHA-256 hash prefix of the tenant ID is prepended to the cached content. This creates an independent cache entry for each tenant with an overhead of only approximately 16 tokens (64 characters).
  6. LangChain integration: Utilizing the ChatBedrockConverse class and the create_cache_point function to generate cache checkpoints directly within message arrays or within ChatPromptTemplate structures and LCEL chains.

Comparing the Converse API and InvokeModel API and Best Practices

The author compares the interfaces and highlights that while the Converse API offers uniform syntax across all supported models, places cache markers as standalone blocks, and provides a cacheDetails breakdown in responses, the InvokeModel API uses differing syntax for Anthropic models (utilizing ephemeral cache_control inside content blocks without cacheDetails response data). Therefore, the Converse API is recommended for new applications.

In conclusion, best practices include profiling prompts to identify static components, ensuring requests satisfy the required token threshold for each model, selecting suitable TTLs, monitoring cache metrics in application logs, incorporating control mechanisms such as Amazon Bedrock Guardrails, and combining simultaneous caching of messages, system prompts, and tool definitions within the same request.

Questions & Answers

FAQ

This article was produced by our AI-assisted system through translation, summarization, and automated quality controls based on original reporting by AWS Machine Learning. Read about our editorial process. Link to the original source.

Get useful AI updates by email

A concise digest from our news desk.

More from AWS Machine Learning

All articles from AWS Machine Learning
Amazon Quick זמין כעת באופן כללי למחשב השולחני
מוצר חדש
4 דקות
מ־AWS Machine Learning

Amazon Quick זמין כעת באופן כללי למחשב השולחני

אפליקציית הדסקטופ של Amazon Quick זמינה כעת באופן כללי למשתמשי macOS ו-Windows, ובמקביל נוסף פיד פעילות למובייל ב-iOS וב-Android. המערכת מרכזת נתונים מדואר אלקטרוני, מיומן פגישות, ממערכות CRM ומהודעות לתצוגה מתועדפת אחת, כאשר סוכני AI מטפלים במשימות שגרתיות ברקע. Quick פועל על גבי תשתיות AWS ושומר על נתוני הארגון בסביבתו המקומית, כולל תמיכה במעקב ביקורת דרך CloudWatch ו-CloudTrail והסמכות תאימות דוגמת HIPAA, FedRAMP, SOC 2 ו-ISO 27001. לקוחות בארגונים כמו Southwest Airlines, LabCorp ו-PGA TOUR משתמשים בכלי להשלמת משימות, סינתזת מידע ופיתוח אבות-טיפוס.

קרא עוד
אחזור סוכני ארגוני ב-Amazon Bedrock עם ניטור והערכה מלאים
חדשות
4 דקות
מ־AWS Machine Learning

אחזור סוכני ארגוני ב-Amazon Bedrock עם ניטור והערכה מלאים

פוסט טכני של מהנדסי AWS מציג ארכיטקטורה לאחזור מידע מבוסס סוכנים (Enterprise Agentic Retrieval) ב-Amazon Bedrock, המשלבת בסיסי ידע מנוהלים (Managed Knowledge Bases) ו-AgentCore. המערכת כוללת ניתוב סמנטי בין בסיסי ידע שונים, אחזור איטרטיבי באמצעות API ייעודי (AgenticRetrieveStream), שבע שכבות של ניטור ועקבות ב-CloudWatch וב-X-Ray, ומנגנוני הערכת איכות לפי דרישה ובאופן רציף. כלל הרכיבים נפרסים באופן אוטומטי באמצעות שרשרת של ארבע מחסניות AWS CloudFormation.

קרא עוד
חיבור Amazon Quick ו-fal לבניית תהליכי עבודה יצירתיים עם סוכנים
מדריך
4 דקות
מ־AWS Machine Learning

חיבור Amazon Quick ו-fal לבניית תהליכי עבודה יצירתיים עם סוכנים

פוסט טכני מאת מומחי AWS מציג מסגרת עבודה מבוססת סוכנים המשלבת בין מרחב העבודה Amazon Quick לבין פלטפורמת המדיה הגנרטיבית fal באמצעות תקן Model Context Protocol (MCP). השילוב מאפשר לצוותי קריאייטיב לתזמר תהליכי הפקה מורכבים תחת סביבה אחידה, תוך שמירה על הקשר בין השלבים ושילוב שערי אישור אנושיים. הפוסט מדגים את המערך באמצעות שני תהליכי עבודה מעשיים: הפקת סטוריבורד בן שמונה פריימים עם מודל FLUX.1 Kontext ושמירתו כ-Skill לשימוש חוזר, ויצירת אב-טיפוס לקליפ מוזיקלי הכולל בדיקת סנכרון שפתיים (lip-sync). בנוסף, מפורטים שלבי ההגדרה ושיקולים תפעוליים כגון אבטחת מפתחות API וניהול עלויות.

קרא עוד
Amazon OpenSearch Service מציגה תמיכה ביישומי MCP
מוצר חדש
4 דקות
מ־AWS Machine Learning

Amazon OpenSearch Service מציגה תמיכה ביישומי MCP

לפי פרסום של שירות Amazon OpenSearch Service, השירות תומך כעת ביישומי MCP (או MCP Apps). יכולת זו מרחיבה את פרוטוקול Model Context Protocol ומאפשרת לסוכני AI להחזיר תגובה כפולה: סיכום טקסטואלי מובנה לצד ויזואליזציות אינטראקטיביות, כגון מפל עקבות ומפות שירותים, המוצגות ישירות בחלון השיחה בסביבת הפיתוח. הוויזואליזציות מופקות באמצעות הרצת קוד שרת מול מקורות הנתונים המחוברים של OpenSearch, ומספקות תוצאות דטרמיניסטיות ללא צורך ביציאה מה-IDE או בפתיחת דפדפן נפרד לאימות.

קרא עוד

More articles you might like

All articles
15 דרכים לשימוש בסוכני AI לניהול רשתות חברתיות לפי Salesforce
מדריך
4 דקות
מ־Salesforce Blog

15 דרכים לשימוש בסוכני AI לניהול רשתות חברתיות לפי Salesforce

מדריך של חברת Salesforce מפרט 15 דרכים שבהן סוכני בינה מלאכותית לרשתות חברתיות מסייעים לעסקים קטנים ובינוניים. הכלים האוטונומיים מאפשרים יצירת תוכן בקול המותג, תזמון פוסטים בזמנים מותאמים אישית, מענה אוטומטי לשאלות נפוצות 24/7, ניתוב פניות מורכבות לנציגים אנושיים, ניטור אזכורים וסנטימנט, וחיבור מעורבות ישירות למערכות ה-CRM לצורך יצירת לידים. בנוסף מובאת דוגמת חברת reMarkable, שטיפלה ביותר מ-18,000 שיחות שירות באמצעות סוכני AI.

קרא עוד
חיבור Amazon Quick ו-fal לבניית תהליכי עבודה יצירתיים עם סוכנים
מדריך
4 דקות
מ־AWS Machine Learning

חיבור Amazon Quick ו-fal לבניית תהליכי עבודה יצירתיים עם סוכנים

פוסט טכני מאת מומחי AWS מציג מסגרת עבודה מבוססת סוכנים המשלבת בין מרחב העבודה Amazon Quick לבין פלטפורמת המדיה הגנרטיבית fal באמצעות תקן Model Context Protocol (MCP). השילוב מאפשר לצוותי קריאייטיב לתזמר תהליכי הפקה מורכבים תחת סביבה אחידה, תוך שמירה על הקשר בין השלבים ושילוב שערי אישור אנושיים. הפוסט מדגים את המערך באמצעות שני תהליכי עבודה מעשיים: הפקת סטוריבורד בן שמונה פריימים עם מודל FLUX.1 Kontext ושמירתו כ-Skill לשימוש חוזר, ויצירת אב-טיפוס לקליפ מוזיקלי הכולל בדיקת סנכרון שפתיים (lip-sync). בנוסף, מפורטים שלבי ההגדרה ושיקולים תפעוליים כגון אבטחת מפתחות API וניהול עלויות.

קרא עוד
מדריך Salesforce: כיצד להרחיב צוות מכירות ברבעון אחד
מדריך
4 דקות
מ־Salesforce Blog

מדריך Salesforce: כיצד להרחיב צוות מכירות ברבעון אחד

מדריך של Salesforce מציג תוכנית רבעונית להרחבת צוות מכירות ללא שחיקה, באמצעות הגדרת תהליך מכירות ברור, אוטומציה של מעקבים ושימוש בבינה מלאכותית. לפי המדריך, 76% מעסקי ה-SMB פועלים מתצוגת CRM משותפת, ו-88% כבר משתמשים ב-AI לניהול לידים ותובנות עסקה. המדריך מפרט צעדים חודשיים הכוללים הגדרת יעדים, קליטת עובדים מבוססת מערכת והדרכה שוטפת.

קרא עוד
בניית מערכת ניהול ידע מבוססת אווטאר ו-AI בענן AWS
מדריך
4 דקות
מ־AWS Machine Learning

בניית מערכת ניהול ידע מבוססת אווטאר ו-AI בענן AWS

בפוסט הנדסי של AWS הוצג פתרון מבוסס ענן לשימור ידע ארגוני, המשלב אווטאר אינטראקטיבי המופעל בדיבור וטקסט עם ארכיטקטורת RAG מנוהלת. המערכת עושה שימוש ב-Amazon Bedrock Knowledge Bases, ב-Amazon S3, במאגר וקטורים של OpenSearch Serverless, ובמנגנון מטמון דו-שכבתי הכולל את DynamoDB. הפתרון מאפשר לעובדים לגשת לנהלים ומדיניות בשפה טבעית, ומסייע לארגונים לשמר מומחיות לפני פרישת עובדים ותיקים. המערכת ניתנת לפריסה מהירה באמצעות CloudFormation, ומציגה הפחתה בעלויות הסקת מודלי בינה מלאכותית בזכות שימוש במטמון חכם לשאלות חוזרות.

קרא עוד