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)