From 3daf7992000ce01a1d42e675df757fb3c469cd2c Mon Sep 17 00:00:00 2001 From: Supernova Date: Wed, 5 Aug 2026 23:42:50 +0000 Subject: [PATCH] Add verified GPT-5.6 Bedrock cache-write pricing (1.25x input rate) OpenAI's own docs confirm the gap flagged in the DUX-11214 follow-up was real, not just unverified: "Cache writes have no additional fee on models before the GPT-5.6 family. For GPT-5.6 models and later model families, cache writes cost 1.25x the uncached input token rate." (https://developers.openai.com/api/docs/guides/prompt-caching) GPT-5.6 is the first OpenAI family billed for cache writes at all, which is why every other OpenAI entry in models.json has no cache_write_input_per_million field - that absence really is $0, not an omission. Add the field to the three hand-added openai.gpt-5.6-luna/-terra/-sol entries (7791056d), computed as 1.25x each model's own input_per_million: Luna: 1.0 x 1.25 = 1.25 Terra: 2.5 x 1.25 = 3.125 Sol: 5.0 x 1.25 = 6.25 Update models_gpt_5_6_bedrock_spec.rb to assert the new rates and replace the "intentionally omitted, unverified" comment with the citation above. Also document a second, separate, still-open concern (not resolved here): OpenAI's developer community reported two GPT-5.6-specific usage-accounting bugs in July 2026 - a cached/cache-write double-counting bug OpenAI staff confirmed and refunded, and a seemingly still-open report of ~9x inflated output_tokens billing. We consume these models via Bedrock's mantle passthrough, not OpenAI's own API, so whether Bedrock reproduces either bug is unknown and unverified - flagged as an open risk to revisit. Co-authored-by: Sam Boland --- lib/ruby_llm/models.json | 18 ++++++---- spec/ruby_llm/models_gpt_5_6_bedrock_spec.rb | 35 +++++++++++++------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/lib/ruby_llm/models.json b/lib/ruby_llm/models.json index a200e78bc..9d983118d 100644 --- a/lib/ruby_llm/models.json +++ b/lib/ruby_llm/models.json @@ -16814,7 +16814,8 @@ "standard": { "input_per_million": 1.0, "output_per_million": 6.0, - "cache_read_input_per_million": 0.1 + "cache_read_input_per_million": 0.1, + "cache_write_input_per_million": 1.25 } } }, @@ -16841,7 +16842,8 @@ "cost": { "input": 1.0, "output": 6.0, - "cache_read": 0.1 + "cache_read": 0.1, + "cache_write": 1.25 }, "limit": { "context": 272000, @@ -16880,7 +16882,8 @@ "standard": { "input_per_million": 5.0, "output_per_million": 30.0, - "cache_read_input_per_million": 0.5 + "cache_read_input_per_million": 0.5, + "cache_write_input_per_million": 6.25 } } }, @@ -16907,7 +16910,8 @@ "cost": { "input": 5.0, "output": 30.0, - "cache_read": 0.5 + "cache_read": 0.5, + "cache_write": 6.25 }, "limit": { "context": 272000, @@ -16946,7 +16950,8 @@ "standard": { "input_per_million": 2.5, "output_per_million": 15.0, - "cache_read_input_per_million": 0.25 + "cache_read_input_per_million": 0.25, + "cache_write_input_per_million": 3.125 } } }, @@ -16973,7 +16978,8 @@ "cost": { "input": 2.5, "output": 15.0, - "cache_read": 0.25 + "cache_read": 0.25, + "cache_write": 3.125 }, "limit": { "context": 272000, diff --git a/spec/ruby_llm/models_gpt_5_6_bedrock_spec.rb b/spec/ruby_llm/models_gpt_5_6_bedrock_spec.rb index ab326ae0c..88bfd36b0 100644 --- a/spec/ruby_llm/models_gpt_5_6_bedrock_spec.rb +++ b/spec/ruby_llm/models_gpt_5_6_bedrock_spec.rb @@ -5,19 +5,30 @@ RSpec.describe RubyLLM::Models do include_context 'with configured RubyLLM' - # None of these three hand-added entries (see 7791056d) carry a - # cache_write_input_per_million rate, matching every other OpenAI-family - # model in models.json — no OpenAI model in this registry has that field - # modeled. This is consistent with, but NOT independently verified - # against, OpenAI/Bedrock pricing docs for GPT-5.6 specifically: whether - # Bedrock charges a distinct (non-zero) cache-write rate for these models, - # the way it does for Anthropic's cache_creation_input_per_million, is - # unknown. Revisit if models.dev adds real entries for these ids, or if - # OpenAI/AWS publish a documented cache-write rate for GPT-5.6. + # cache_write is verified, not a placeholder: per OpenAI's own docs + # (https://developers.openai.com/api/docs/guides/prompt-caching), "Cache + # writes have no additional fee on models before the GPT-5.6 family. For + # GPT-5.6 models and later model families, cache writes cost 1.25x the + # uncached input token rate." GPT-5.6 is the first OpenAI family to charge + # for cache writes at all, which is why it's the only OpenAI family in this + # registry carrying a cache_write_input_per_million value — every other + # OpenAI entry has none because the rate really is $0 for those models. + # + # Separately open (do NOT resolve here): OpenAI's developer community has + # reported two GPT-5.6-specific usage-accounting bugs since launch (July + # 2026) — one where cached_tokens + cache_write_tokens could nearly + # double-count against prompt_tokens (OpenAI staff andyw1 confirmed this + # and issued retroactive refunds), and a second, seemingly still-open one + # alleging usage.output_tokens can be inflated ~9x by a reasoning-token + # resummation bug, with the inflated figure being what's billed. We consume + # these models via AWS Bedrock's mantle passthrough, not OpenAI's own API, + # so it is unknown and unverified whether Bedrock's usage accounting + # reproduces either bug or computes usage independently. Treat billed + # Luna/Terra/Sol costs as an open risk until this is checked. { - 'openai.gpt-5.6-sol' => { input: 5.0, output: 30.0, cache_read: 0.5 }, - 'openai.gpt-5.6-terra' => { input: 2.5, output: 15.0, cache_read: 0.25 }, - 'openai.gpt-5.6-luna' => { input: 1.0, output: 6.0, cache_read: 0.1 } + 'openai.gpt-5.6-sol' => { input: 5.0, output: 30.0, cache_read: 0.5, cache_write: 6.25 }, + 'openai.gpt-5.6-terra' => { input: 2.5, output: 15.0, cache_read: 0.25, cache_write: 3.125 }, + 'openai.gpt-5.6-luna' => { input: 1.0, output: 6.0, cache_read: 0.1, cache_write: 1.25 } }.each do |id, cost| it "resolves #{id} from the bedrock provider with the documented effort values" do model = RubyLLM.models.find(id, :bedrock)