diff --git a/litellm/proxy/spend_tracking/spend_tracking_utils.py b/litellm/proxy/spend_tracking/spend_tracking_utils.py index c36e50eb97a..6b5bb1614c5 100644 --- a/litellm/proxy/spend_tracking/spend_tracking_utils.py +++ b/litellm/proxy/spend_tracking/spend_tracking_utils.py @@ -96,9 +96,8 @@ def _get_spend_logs_metadata( # Filter the metadata dictionary to include only the specified keys clean_metadata = SpendLogsMetadata( **{ # type: ignore - key: metadata[key] + key: metadata.get(key) for key in SpendLogsMetadata.__annotations__.keys() - if key in metadata } ) clean_metadata["applied_guardrails"] = applied_guardrails