From 508bb9560f70783ab689996344c23e3772978781 Mon Sep 17 00:00:00 2001 From: r266-tech Date: Tue, 27 Oct 2026 22:24:47 +0800 Subject: [PATCH] fix: correct Sonnet 5.5 cache read fallback pricing --- backend/internal/service/billing_service.go | 2 +- backend/internal/service/billing_service_test.go | 3 ++- backend/internal/service/pricing_service.go | 2 +- .../model-pricing/model_prices_and_context_window.json | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/internal/service/billing_service.go b/backend/internal/service/billing_service.go index f66293ba04..57dab87cfc 100644 --- a/backend/internal/service/billing_service.go +++ b/backend/internal/service/billing_service.go @@ -423,7 +423,7 @@ func (s *BillingService) initFallbackPricing() { InputPricePerToken: 2e-6, OutputPricePerToken: 10e-6, CacheCreationPricePerToken: 2.5e-6, - CacheReadPricePerToken: 0.2e-6, + CacheReadPricePerToken: 0.1e-6, CacheCreation5mPrice: 2.5e-6, CacheCreation1hPrice: 4e-6, SupportsCacheBreakdown: true, diff --git a/backend/internal/service/billing_service_test.go b/backend/internal/service/billing_service_test.go index cb68489b49..52264f8058 100644 --- a/backend/internal/service/billing_service_test.go +++ b/backend/internal/service/billing_service_test.go @@ -2104,7 +2104,8 @@ func TestNewModelPricingCatalogFallbackAndContext(t *testing.T) { require.NoError(t, err) require.InDelta(t, 100_000*2e-6, cost.InputCost, 1e-10) require.InDelta(t, 400*2.5e-6+600*4e-6, cost.CacheCreationCost, 1e-10) - require.InDelta(t, 1000*0.2e-6, cost.CacheReadCost, 1e-10) + // Sonnet 5.5 cache hits cost 5% of the $2/MTok input price (#8378). + require.InDelta(t, 1000*0.1e-6, cost.CacheReadCost, 1e-10) require.InDelta(t, 500*10e-6, cost.OutputCost, 1e-10) require.False(t, cost.LongContextBillingApplied) }) diff --git a/backend/internal/service/pricing_service.go b/backend/internal/service/pricing_service.go index 08f7f9d6ba..6155e49438 100644 --- a/backend/internal/service/pricing_service.go +++ b/backend/internal/service/pricing_service.go @@ -153,7 +153,7 @@ var ( claudeSonnet55FallbackPricing = &LiteLLMModelPricing{ InputCostPerToken: 2e-6, OutputCostPerToken: 10e-6, CacheCreationInputTokenCost: 2.5e-6, CacheCreationInputTokenCostAbove1hr: 4e-6, - CacheReadInputTokenCost: 0.2e-6, + CacheReadInputTokenCost: 0.1e-6, LiteLLMProvider: "anthropic", Mode: "chat", SupportsPromptCaching: true, } claudeHaiku55FallbackPricing = &LiteLLMModelPricing{ diff --git a/backend/resources/model-pricing/model_prices_and_context_window.json b/backend/resources/model-pricing/model_prices_and_context_window.json index cd1e84434f..3ef1e53ccd 100644 --- a/backend/resources/model-pricing/model_prices_and_context_window.json +++ b/backend/resources/model-pricing/model_prices_and_context_window.json @@ -1015,7 +1015,7 @@ "claude-sonnet-5-5": { "cache_creation_input_token_cost": 2.5e-06, "cache_creation_input_token_cost_above_1hr": 4e-06, - "cache_read_input_token_cost": 2e-07, + "cache_read_input_token_cost": 1e-07, "input_cost_per_token": 2e-06, "litellm_provider": "anthropic", "max_input_tokens": 1000000,