diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 5ee3b751ff6..bb4bfe47a05 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -831,7 +831,10 @@ async def user_api_key_auth( raise Exception( f"This key is made for LiteLLM UI, Tried to access route: {route}. Not allowed" ) - return UserAPIKeyAuth(api_key=api_key, **valid_token_dict) + if valid_token_dict is not None: + return UserAPIKeyAuth(api_key=api_key, **valid_token_dict) + else: + raise Exception() except Exception as e: # verbose_proxy_logger.debug(f"An exception occurred - {traceback.format_exc()}") traceback.print_exc() diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index ee5e323e8ef..81130787d07 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -973,7 +973,7 @@ class PrismaClient: t.rpm_limit AS team_rpm_limit, m.aliases as team_model_aliases FROM "LiteLLM_VerificationToken" AS v - INNER JOIN "LiteLLM_TeamTable" AS t ON v.team_id = t.team_id + LEFT JOIN "LiteLLM_TeamTable" AS t ON v.team_id = t.team_id LEFT JOIN "LiteLLM_ModelTable" m ON t.model_id = m.id WHERE v.token = '{token}' """