Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(cost_calculator.py): respect litellm.suppress_debug_info for cost calc

Krrish Dholakia186dabebcb8b
diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py
index 7b8bfb0d98c..5545b842809 100644
--- a/litellm/cost_calculator.py
+++ b/litellm/cost_calculator.py
@@ -735,9 +735,16 @@ def response_cost_calculator(
)
return None
except Exception as e:
- verbose_logger.warning(
- "litellm.cost_calculator.py::response_cost_calculator - Returning None. Exception occurred - {}/n{}".format(
- str(e), traceback.format_exc()
+ if litellm.suppress_debug_info: # allow cli tools to suppress this information.
+ verbose_logger.debug(
+ "litellm.cost_calculator.py::response_cost_calculator - Returning None. Exception occurred - {}/n{}".format(
+ str(e), traceback.format_exc()
+ )
+ )
+ else:
+ verbose_logger.warning(
+ "litellm.cost_calculator.py::response_cost_calculator - Returning None. Exception occurred - {}/n{}".format(
+ str(e), traceback.format_exc()
+ )
)
- )
return None