From e53717f050a8abfe619a5a79b54c342c9bcfecbc Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 23 Jan 2024 16:19:32 -0800 Subject: [PATCH] fix(proxy/utils.py): remove original auth sk-.. key before logging to spend logs --- litellm/proxy/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index fb5b523a76..1c504ca936 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -838,6 +838,11 @@ def get_logging_payload(kwargs, response_obj, start_time, end_time): # hash the api_key api_key = hash_token(api_key) + if "headers" in metadata and "authorization" in metadata["headers"]: + metadata["headers"].pop( + "authorization" + ) # do not store the original `sk-..` api key in the db + payload = { "request_id": id, "call_type": call_type,