2026 OpenAI Prompt Caching 官方价格怎么算:输入/输出/缓存字段全解析
内容刷新 / GEO:补 English summary 与最新核对清单 — oa-2026-openai-cache-pricing-guide

2026 OpenAI Prompt Caching 官方价格怎么算:输入/输出/缓存字段全解析
OpenAI Prompt Caching 让 API 调用中的重复 prompt prefix(前缀)共享计算结果,从而显著降低延迟和成本。适合频繁复用系统提示词、工具定义、历史上下文的开发者或企业——如构建持久代理、长对话应用或多轮工具链。决策时,先查看你的模型是否支持(GPT-5.6 及以上),再对照官方定价表,算出实际单价,再结合缓存命中率决定是否开启。
现状与数据更新
2026 年 OpenAI 在 Responses API 上将 Prompt Caching 从 30 分钟缓存提升至支持 12 小时有效期,同时优化了 GPT-6 系列模型的缓存读写倍率。缓存写入不再是纯额外费用,而是按特定倍率计入 input tokens;读取则享受大幅折扣(最高降至 0.05 倍标准 input 价)。缓存命中率可达 90% 以上,延迟缩短 80%,成本降低 90% 是常见效果。
官方数据以 platform.openai.com/docs/pricing 为准(2026 年 11 月 6 日最新核对)。不同模型有 short/long context 之分,cached input 字段直接出现在 response.usage.input_tokens_details 中,便于你对账单。
核对清单
以下清单帮你快速确认是否命中缓存并计算正确账单:
- 检查
response.usage.input_tokens_details.cached_tokens是否大于 0(表示命中) - 确认
prompt_cache_options设置正确(30m / 12h) - 比对
prompt_cache_write_tokens(写入消耗) - 运行
prompt_cache_diagnostics(如 GPT-5.6+ 支持),看 miss 原因 - 核对模型 tier(short/long context)、工具/格式是否一致
- 用 Prompt Caching Dashboard 监控全局命中率
风险边界
缓存依赖 exact prefix 匹配,任何工具名改动、reasoning.effort 变化或 context_compaction 都会导致 miss。12 小时缓存对静态 prompt 更友好,但动态场景下命中率会掉;长上下文(>272K tokens)缓存上限更低;regional endpoint 或 fallback 路由可能触发不同权重。使用时注意:缓存状态不持久(会过期),请勿依赖其作为“永久”优化。非法律意见声明:本文仅供参考,具体计费以 OpenAI 官方页面实时数据为准,实际账单可能因市场调整或策略变化而异。
站内路径
风险与边界
缓存写入费用(2.5× input 价)仅在首次或配置变更时生效,之后读操作才享 0.05–0.1× 折扣。频繁改 prompt 反而会增加写入成本并降低命中率,建议把稳定部分放 breakpoints 前。本文非法律意见:仅供开发者自助核对,不构成任何合同或保证。实际对账请以 OpenAI 平台当日报表为准,任何绕过官方计费的行为均属违规。
如何计算单价?(示例表格)
| 场景 | Input 总 tokens | Cached tokens | 写入 tokens | 写入倍率 | 读入倍率 | 输出 tokens | 实际计费估算($/M) |
|---|---|---|---|---|---|---|---|
| 30min 写入 | 10,000 | 7,000 | 3,000 | 1.25× | 0.1× | 1,000 | 约 0.35 |
| 12h 写入 | 12,000 | 8,000 | 4,000 | 2.5× | 0.05× | 2,000 | 约 0.55 |
| 无缓存 | 10,000 | 0 | 0 | - | - | 1,000 | 约 2.00 |
注:以上为 GPT-6.1 Sol 等模型 illustrative 值,实际以官方定价表为准。
延伸阅读
English summary
OpenAI Prompt Caching reuses the same prompt prefix across API requests to avoid redundant computation, delivering up to 90% lower input costs and 80% faster response times for supported models (GPT-5.6 and later). In 2026, the system supports 12-hour cache lifetimes via the Responses API, with cache writes charged at 1.25× or 2.5× standard input rates depending on lifetime and model tier (short or long context). Reads enjoy deep discounts — typically 0.05× to 0.1× — and cached tokens appear in usage.input_tokens_details.cached_tokens. Cache breakpoints and diagnostics help you maintain reuse by keeping tools, instructions, and settings stable. Check official pricing at platform.openai.com/docs/pricing for exact $/M rates per model, as they vary by context length and service tier. This guide helps developers calculate exact billing by parsing usage fields and comparing against the official price table. Always verify latest data, as rates and support can change. For detailed code examples and diagnostics, see the linked internal resources.