From 419913543c99082201ac51149d76e074ab35eb0e Mon Sep 17 00:00:00 2001 From: Paul Holstein <44263169+holstein13@users.noreply.github.com> Date: Mon, 23 Feb 2026 12:56:38 -0500 Subject: [PATCH] fix(review): treat 0 tiered rate as valid, warn on cache-only unknown models - calculateTieredCost: use `== null` instead of `!` so a 0 tiered rate is not treated as missing - calculateMessageCost: include cacheReadTokens and cacheCreationTokens in the unknown-model warning condition Co-Authored-By: Claude Opus 4.6 --- src/shared/utils/pricing.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/utils/pricing.ts b/src/shared/utils/pricing.ts index 28800696..7a175df1 100644 --- a/src/shared/utils/pricing.ts +++ b/src/shared/utils/pricing.ts @@ -61,7 +61,7 @@ export function getPricing(modelName: string): LiteLLMPricing | null { export function calculateTieredCost(tokens: number, baseRate: number, tieredRate?: number): number { if (tokens <= 0) return 0; - if (!tieredRate || tokens <= TIER_THRESHOLD) { + if (tieredRate == null || tokens <= TIER_THRESHOLD) { return tokens * baseRate; } const costBelow = TIER_THRESHOLD * baseRate; @@ -78,7 +78,7 @@ export function calculateMessageCost( ): number { const pricing = getPricing(modelName); if (!pricing) { - if (inputTokens > 0 || outputTokens > 0) { + if (inputTokens > 0 || outputTokens > 0 || cacheReadTokens > 0 || cacheCreationTokens > 0) { console.warn(`[pricing] No pricing data for model "${modelName}", cost will be $0`); } return 0;