From e989175c10ac5aa30a20b970b355e95e21eeeedb Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 26 Jan 2024 13:29:02 -0800 Subject: [PATCH] fix(proxy/utils.py): accept token hashes for deleting tokens --- litellm/proxy/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 375f393383c..0e0d27a427b 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -814,7 +814,13 @@ class PrismaClient: Allow user to delete a key(s) """ try: - hashed_tokens = [self.hash_token(token=token) for token in tokens] + hashed_tokens = [] + for token in tokens: + if isinstance(token, str) and token.startswith("sk-"): + hashed_token = self.hash_token(token=token) + else: + hashed_token = token + hashed_tokens.append(hashed_token) await self.db.litellm_verificationtoken.delete_many( where={"token": {"in": hashed_tokens}} )