fix ProxyUpdateSpend

This commit is contained in:
Ishaan Jaff 2025-03-17 22:17:56 -07:00
parent 537bed127b
commit 0c1d00864d

View file

@ -13,6 +13,7 @@ from litellm.litellm_core_utils.core_helpers import (
from litellm.litellm_core_utils.litellm_logging import StandardLoggingPayloadSetup from litellm.litellm_core_utils.litellm_logging import StandardLoggingPayloadSetup
from litellm.proxy._types import UserAPIKeyAuth from litellm.proxy._types import UserAPIKeyAuth
from litellm.proxy.auth.auth_checks import log_db_metrics from litellm.proxy.auth.auth_checks import log_db_metrics
from litellm.proxy.utils import ProxyUpdateSpend
from litellm.types.utils import ( from litellm.types.utils import (
StandardLoggingPayload, StandardLoggingPayload,
StandardLoggingUserAPIKeyMetadata, StandardLoggingUserAPIKeyMetadata,
@ -230,6 +231,11 @@ def _should_track_cost_callback(
""" """
Determine if the cost callback should be tracked based on the kwargs Determine if the cost callback should be tracked based on the kwargs
""" """
# don't run track cost callback if user opted into disabling spend
if ProxyUpdateSpend.disable_spend_updates() is True:
return False
if ( if (
user_api_key is not None user_api_key is not None
or user_id is not None or user_id is not None