From 03791c2a000a118257f091aaa3861b52dd7ed952 Mon Sep 17 00:00:00 2001 From: Saee Barve Date: Thu, 18 Jun 2026 00:23:46 +0530 Subject: [PATCH] fix(auth): hash virtual key before logging on BudgetExceededError --- litellm/proxy/auth/auth_exception_handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/auth/auth_exception_handler.py b/litellm/proxy/auth/auth_exception_handler.py index f76949f4d11..1cc37c8121f 100644 --- a/litellm/proxy/auth/auth_exception_handler.py +++ b/litellm/proxy/auth/auth_exception_handler.py @@ -1,6 +1,7 @@ """ Handles Authentication Errors """ +from litellm.proxy.utils import hash_token from typing import TYPE_CHECKING, Any, Optional, Union @@ -115,7 +116,7 @@ class UserAPIKeyAuthExceptionHandler: user_api_key_dict.parent_otel_span = parent_otel_span user_api_key_dict.request_route = route user_api_key_dict.api_key = ( - user_api_key_dict.api_key or UserAPIKeyAuth(api_key=api_key).api_key + user_api_key_dict.api_key or hash_token(api_key) if api_key else None ) # Stamp identity onto the request's server span now, before the request