From 02e4530bfec81efdde75efe24640926d81eb7ccb Mon Sep 17 00:00:00 2001 From: Harshit Jain Date: Wed, 18 Feb 2026 17:47:31 +0530 Subject: [PATCH] fix: add missing var in standard logging metadata --- litellm/litellm_core_utils/litellm_logging.py | 16 ++++++++++++++-- litellm/types/utils.py | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index bdbbc7579b7..6a14e42c485 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -1335,7 +1335,11 @@ class Logging(LiteLLMLoggingBaseClass): ) # Store additional costs if provided (free-form dict for extensibility) - if additional_costs and isinstance(additional_costs, dict) and len(additional_costs) > 0: + if ( + additional_costs + and isinstance(additional_costs, dict) + and len(additional_costs) > 0 + ): self.cost_breakdown["additional_costs"] = additional_costs # Store discount information if provided @@ -4519,13 +4523,19 @@ class StandardLoggingPayloadSetup: requester_custom_headers=None, cold_storage_object_key=None, user_api_key_auth_metadata=None, + team_alias=None, + team_id=None, ) if isinstance(metadata, dict): for key in metadata.keys() & _STANDARD_LOGGING_METADATA_KEYS: clean_metadata[key] = metadata[key] # type: ignore user_api_key = metadata.get("user_api_key") - if user_api_key and isinstance(user_api_key, str) and is_valid_sha256_hash(user_api_key): + if ( + user_api_key + and isinstance(user_api_key, str) + and is_valid_sha256_hash(user_api_key) + ): clean_metadata["user_api_key_hash"] = user_api_key _potential_requester_metadata = metadata.get( "metadata", None @@ -5279,6 +5289,8 @@ def get_standard_logging_metadata( user_api_key_request_route=None, cold_storage_object_key=None, user_api_key_auth_metadata=None, + team_alias=None, + team_id=None, ) if isinstance(metadata, dict): # Update the clean_metadata with values from input metadata that match StandardLoggingMetadata fields diff --git a/litellm/types/utils.py b/litellm/types/utils.py index 5f8798c7712..8eb13f333f3 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -2532,6 +2532,8 @@ class StandardLoggingMetadata(StandardLoggingUserAPIKeyMetadata): cold_storage_object_key: Optional[ str ] # S3/GCS object key for cold storage retrieval + team_alias: Optional[str] + team_id: Optional[str] class StandardLoggingAdditionalHeaders(TypedDict, total=False):