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: add missing var in standard logging metadata

Harshit Jain02e4530bfec8
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):