How-toOfficial

Amazon Bedrock 开源模型支持提示词缓存

Use prompt caching with open-weight models on Amazon Bedrock

Why we picked it

如果你在 Bedrock 上跑开源模型,这篇能直接省钱:教你怎么用隐式和显式两种缓存,还给了 OpenCode 编程智能体的实战例子,重复上下文不再重复计费。

AWS 宣布 Amazon Bedrock 上的开源模型支持提示词缓存,通过复用重复的长上下文降低输入成本和延迟。

Image · AWS Machine Learning Blog
Body

文章区分了两种缓存方式:隐式缓存由系统自动识别请求中相同的上下文前缀,显式缓存则由开发者手动标记缓存断点。两种方式均可通过 Chat Completions API 调用,无需更改模型部署。

文中给出一个实际用例:在 OpenCode 编程智能体的一次会话中应用缓存。编程智能体每轮对话都会重发相同的系统提示、代码库上下文和历史消息,缓存命中后重复输入不再按全价计费,也不必重新计算,适合长会话和高频调用的应用。

Original · AWS Machine Learning Blog

Use prompt caching with open-weight models on Amazon Bedrock

Many generative AI applications resend the same long context on every request. Prompt caching lets open-weight models on Amazon Bedrock reuse it to reduce input cost and latency. This post shows implicit and explicit caching through the Chat Completions API and applies caching to an OpenCode coding agent session.

Industry Coordinates & Source Verification

This report is categorized under AITOP's "How-to" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows and US-China foundation model benchmarks and commercialization comparison. Key entities and technical topics under continuous tracking include Amazon Bedrock, OpenCode, prompt caching, coding assistants.

Primary source verification: published directly by AWS Machine Learning Blog with first-party authority.