From e63af354ecbcd7d27fa0874f25e836d49f0f2f30 Mon Sep 17 00:00:00 2001 From: VAI Date: Sat, 27 Jun 2026 09:48:39 +0000 Subject: [PATCH] fix(audit): handle None values in dynamic pricing registry --- litellm_dashboard.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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}]"