prompt cache 缓存读取算不算 Claude Code 和 Codex 的额度?
更新于
算。缓存读取照样计入,只是打折。Claude Code 按缓存 token 费率重读历史,所以在开了一整天的会话里问一句话,仍会为整段对话扣额度;缓存读取按基础输入价的 0.1 倍计,停顿超过订阅版一小时的缓存有效期就会整段重读。OpenAI 把缓存列为影响 Codex 用量的因素之一,缓存输入按输入价的十分之一计。
官方文档怎么说
Cache read tokens are 0.1 times the base input tokens price
引自 Claude Platform docs: Prompt caching a one-line question in a session that has been open all day still draws usage for the whole conversation
引自 Claude Code docs: Manage costs effectively Cache misses: your first message after a break longer than the cache lifetime misses the cache and reprocesses your full context.
引自 Claude Code docs: Manage costs effectively The lifetime is an hour on a subscription
引自 Claude Code docs: Manage costs effectively Model choice, context, reasoning, tool use, retrieval, and caching all affect usage
引自 Codex docs: Pricing (learn.chatgpt.com) we root caused it to an optimization that we rolled back that had an impact on cache hit rates
引自 Tibo Sottiaux on X, 2026-05-23 (cache hit rate optimization rolled back)
怎么算
在 Claude 上,缓存命中是更便宜的输入,不是免费输入。Platform 文档说缓存读取 token 按基础输入 token 价格的 0.1 倍计(Claude Fable 5.1 与 Mythos 5.1 为 0.025 倍),缓存写入则是 5 分钟缓存 1.25 倍、1 小时缓存 2 倍。
Claude Code 把这套规则套在整段对话上。开启 prompt caching 后它按缓存 token 费率重读历史,所以在开了一整天的会话里问一句话仍然会为整段对话扣额度。未命中更糟:停顿超过缓存有效期后的第一条消息会未命中缓存并重新处理全部上下文,而订阅版的有效期是一小时。/usage 的分解会在长上下文或缓存未命中占最近用量 10% 以上时标出来。
Codex 用更少的字说了同样的话:模型选择、上下文、reasoning、工具使用、检索和缓存都影响用量。它的积分价目表把缓存输入按输入的十分之一计(GPT-6 Astra 每百万缓存 token 25 积分,输入为 250)。2026-05-23,Tibo Sottiaux 把一轮额度消耗过快追溯到一个影响缓存命中率的优化,并已回滚。
常见问题
为什么在很长的 Claude Code 会话里问一句话也很费额度?
因为整段历史都被重读了。Claude Code 文档说开启 prompt caching 后它按缓存 token 费率重读历史,所以在开了一整天的会话里问一句话,仍然会为整段对话扣额度。
订阅版 Claude Code 的缓存能保持多久?
一小时。文档说订阅版的有效期是一小时,停顿超过缓存有效期后的第一条消息会未命中缓存并重新处理全部上下文。长时间离开后新开会话,可以避免为一段过期历史付费。
Codex 会为缓存输入扣额度吗?
会,按折扣计。定价页把缓存列在影响用量的因素里,积分价目表把缓存输入按输入价的十分之一计(GPT-6 Astra 每百万 token 25 积分,输入为 250)。
缓存出过让额度掉得更快的问题吗?
2026-05-23,Tibo Sottiaux 写道 Codex 已把问题追溯到一个影响缓存命中率的优化并回滚。命中率降低意味着更多全价输入,用户看到的就是额度掉得更快。
来源
- Claude Platform docs: Prompt caching核实于 2026-09-17
- Claude Code docs: Manage costs effectively核实于 2026-09-17
- Codex docs: Pricing (learn.chatgpt.com)核实于 2026-09-17
- Tibo Sottiaux on X, 2026-05-23 (cache hit rate optimization rolled back)核实于 2026-09-17