AWS Bedrock 出现漏洞导致费用增加 10 倍的说明文档
Codex on AWS bedrock bug causing 10x charges

原始链接: https://github.com/openai/codex/issues/37674

Codex CLI 的原生 Amazon Bedrock 提供程序目前不支持 `openai.gpt-5.6-sol` 模型的显式提示词缓存(Prompt Caching)。在处理具有长且稳定的指令前缀的智能体(Agentic)工作负载时,这一限制迫使系统进行全前缀重写,导致缓存写入 Token 数量过多,从而显著增加了成本。 2026 年 8 月 5 日至 8 日的数据显示,缓存写入费用约占总支出的 85%(1,386 美元中的 1,182 美元)。由于当前的 Bedrock 提供程序配置未公开结构化的请求体转换功能,用户无法手动启用 AWS 文档中所述的缓存机制。 **建议改进:** * **协议支持:** 更新提供程序以序列化 `prompt_cache_options`,并在输入内容块中包含 `prompt_cache_breakpoint`。 * **优化:** 实现一种策略性放置机制,以缓存稳定的工具定义和指令。 * **可观测性:** 在每轮遥测中显示缓存读/写指标,以便用户识别和诊断高成本的重写模式。 此更新对于利用 AWS 原生缓存功能运行 GPT-5.6 至关重要,能够实现复杂智能体任务的经济高效执行。

一篇 Hacker News 讨论指出,AWS Bedrock 上的 OpenAI Codex 存在一个严重漏洞:由于缓存机制失效(读写比低于 5%),导致用户产生的费用高达预期的 10 倍。用户发现,禁用 `web_search` 可作为临时的权宜之计。 该话题引发了关于 OpenAI 近期模型更新(v5.6)的广泛讨论。评论者推测,架构上的调整(可能从传统的注意力机制转向循环机制)可能改变了缓存行为,进而影响了性能和成本透明度。 除了技术漏洞外,此次讨论还反映了开发者群体日益增长的挫败感。用户表达了以下担忧: * **“静默”更新:** 模型行为(如缓存处理)的重要变更往往在没有清晰文档或发布说明的情况下实施。 * **AI 生成的“噪音”:** 参与者指出,问题追踪系统中充斥着大量由 AI 生成的、逻辑不通的评论,阻碍了真正的调试工作。 * **对可靠性的怀疑:** 这类“过度收费”漏洞的频发,加剧了人们对 AI 是否已为大规模企业级开发做好准备的怀疑;一些人认为,管理层更倾向于开发速度而非系统稳定性。 总而言之,用户认为,尽管这些问题可能是技术上的疏忽,但它们导致了付费 API 服务在可靠性和透明度上的口碑下滑。
相关文章

原文

Summary

Native Codex CLI requests to Amazon Bedrock Mantle cannot opt into GPT-5.6 Sol explicit prompt caching. On an agentic coding workload, this has produced a large volume of cache-write tokens and materially higher cost.

This is related to #35300, but adds independent production usage evidence from the native amazon-bedrock provider.

Environment

  • Codex CLI: 0.147.0
  • Provider: native amazon-bedrock
  • Endpoint: Bedrock Mantle Responses API, us-east-1
  • Model: openai.gpt-5.6-sol

Observed production usage

For the completed days 2026-08-05 through 2026-08-08, Cost Explorer usage quantities and the Bedrock rate card produced the following cache-aware estimate for Sol:

Requests Cache-write tokens Estimated cache-write cost Estimated total cost
3,656 171.94M $1,182.09 $1,386.46

Cache writes were about 85% of the model's estimated spend.

A local Codex session also reported 76 Sol requests with 6.709M cache_write_input_tokens, zero cached_input_tokens, and an average of about 88K cache-write tokens per request. There were no client errors in the corresponding CloudWatch metrics.

These are usage-derived estimates, not finalized AWS invoice amounts.

Investigation

Codex already emits a session-scoped prompt_cache_key, but the request types for both HTTP and WebSocket Responses requests do not include either:

  • prompt_cache_options
  • prompt_cache_breakpoint

The built-in Amazon Bedrock provider config exposes transport/auth settings, not structured request-body transformation, so this cannot be configured through config.toml.

AWS documents explicit cache mode for GPT-5.6 on Bedrock specifically for agentic workflows with long stable instructions/tool definitions followed by changing tool and user content. That matches the workload above.

Requested behavior

  1. Add support for serializing prompt_cache_options for GPT-5.6-capable Responses providers.
  2. Add a typed prompt_cache_breakpoint field to supported input content blocks.
  3. Provide a provider/model capability gate and a safe placement strategy at the end of Codex's measured stable instruction/tool prefix.
  4. Surface cache reads and cache writes in per-turn usage telemetry so users can diagnose costly full-prefix rewrites.

Scope

This report does not claim that every cache write is a defect. Cold starts, genuinely distinct prompts, forks, and compaction can all require writes. The issue is that native Bedrock Codex currently has no way to use the documented explicit-cache mechanism for the stable-prefix case.

联系我们 contact @ memedata.com