diff --git a/backend/internal/service/account_stats_pricing_test.go b/backend/internal/service/account_stats_pricing_test.go index 1bd28896fc..84ca0897ec 100644 --- a/backend/internal/service/account_stats_pricing_test.go +++ b/backend/internal/service/account_stats_pricing_test.go @@ -594,8 +594,9 @@ func TestTryModelFilePricing_WithImageOutput(t *testing.T) { } result := tryModelFilePricing(bs, "claude-sonnet-4", tokens, "") require.NotNil(t, result) - // 100*0.001 + 50*0.002 + 10*0.01 = 0.1 + 0.1 + 0.1 = 0.3 - require.InDelta(t, 0.3, *result, 1e-12) + // ImageOutputTokens 是 OutputTokens 的子集,先扣除再按图片单价计。 + // 100*0.001 + (50-10)*0.002 + 10*0.01 = 0.1 + 0.08 + 0.1 = 0.28 + require.InDelta(t, 0.28, *result, 1e-12) } func TestTryModelFilePricing_WithCacheTokens(t *testing.T) {