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 上的 Codex 漏洞导致费用激增 10 倍 (github.com/openai) 5 分 | TheP1000 发布于 43 分钟前 | 隐藏 | 过往 | 收藏 | 1 条评论 TheP1000 43 分钟前 [–] 我们在 AWS Bedrock 上 Codex 的读/写缓存比率低于 5%。缓存写入的成本非常高,但它们从未被使用过。这导致 AWS Bedrock 上的 Codex 因没有缓存且存在大量写入,造成了约为正常水平 10 倍的费用。问题中的临时解决方案解决了我的问题: web_search = "disabled" 回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

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