fix(proxy_server.py): handle view spend logs for api key none object

This commit is contained in:
Krrish Dholakia 2024-01-24 14:57:21 -08:00
parent 3e7ed4082a
commit f9d159797a

View file

@ -2538,7 +2538,7 @@ async def view_spend_logs(
f"Database not connected. Connect a database to your proxy - https://docs.litellm.ai/docs/simple_proxy#managing-auth---virtual-keys" f"Database not connected. Connect a database to your proxy - https://docs.litellm.ai/docs/simple_proxy#managing-auth---virtual-keys"
) )
spend_logs = [] spend_logs = []
if api_key is not None: if api_key is not None and isinstance(api_key, str):
if api_key.startswith("sk-"): if api_key.startswith("sk-"):
hashed_token = prisma_client.hash_token(token=api_key) hashed_token = prisma_client.hash_token(token=api_key)
else: else: