From 7a8c1c37191a2a84c268936cc81023b7b2a7cece Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 1 Jul 2026 04:29:40 +0000 Subject: [PATCH] refactor(cost_calculator): add debug logging on fallback to param-size pricing Address Greptile review: bare except was silently swallowing errors. Log the original exception at debug level so fallbacks are traceable --- litellm/llms/fireworks_ai/cost_calculator.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/litellm/llms/fireworks_ai/cost_calculator.py b/litellm/llms/fireworks_ai/cost_calculator.py index ffa04f377a5..9fce9b0dd94 100644 --- a/litellm/llms/fireworks_ai/cost_calculator.py +++ b/litellm/llms/fireworks_ai/cost_calculator.py @@ -60,6 +60,13 @@ def cost_per_token(model: str, usage: Usage) -> Tuple[float, float]: """ try: return generic_cost_per_token(model=model, usage=usage, custom_llm_provider="fireworks_ai") - except Exception: + except Exception as e: + from litellm._logging import verbose_logger + + verbose_logger.debug( + "fireworks_ai cost_per_token: model=%s not found, falling back to param-size pricing. Error: %s", + model, + str(e), + ) base_model = get_base_model_for_pricing(model_name=model) return generic_cost_per_token(model=base_model, usage=usage, custom_llm_provider="fireworks_ai")