diff --git a/litellm_dashboard.py b/litellm_dashboard.py index 85b7569..b3e094a 100644 --- a/litellm_dashboard.py +++ b/litellm_dashboard.py @@ -101,10 +101,10 @@ class Tools: if not pricing: return "" uncached = max(0, prompt - cached) actual_output = max(0, completion - reasoning) - calc = (cached * pricing.get("input_cached", 0)) + \ - (uncached * pricing.get("input", 0)) + \ - (actual_output * pricing.get("output", 0)) + \ - (reasoning * pricing.get("reasoning", pricing.get("output", 0))) + calc = (cached * (pricing.get("input_cached") or 0)) + \ + (uncached * (pricing.get("input") or 0)) + \ + (actual_output * (pricing.get("output") or 0)) + \ + (reasoning * (pricing.get("reasoning") or pricing.get("output") or 0)) delta = reported_cost - calc symbol = "⚠️" if abs(delta) > 0.005 else "✓" return f" [calc: ${calc:.4f} {symbol}]"