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
This commit is contained in:
devin-ai-integration[bot] 2026-07-01 04:29:40 +00:00 • committed by GitHub
parent 282f73b0cd
commit 7a8c1c3719
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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")