From 3e66fb2a83d060227dc5500bc60751b3440e59f7 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 28 Oct 2023 14:09:57 -0700 Subject: [PATCH] build(litellm_server/main.py): updates --- litellm_server/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm_server/main.py b/litellm_server/main.py index c040b7433..84cd0aaa1 100644 --- a/litellm_server/main.py +++ b/litellm_server/main.py @@ -108,7 +108,8 @@ async def chat_completion(request: Request, model: Optional[str] = None): if (env_validation['keys_in_environment'] is False or os.getenv("AUTH_STRATEGY", None) == "DYNAMIC") and ("authorization" in request.headers or "api-key" in request.headers): # if users pass LLM api keys as part of header api_key = request.headers.get("authorization") print(f"api_key in headers: {api_key}") - api_key = api_key.split(" ")[1] + if " " in api_key: + api_key = api_key.split(" ")[1] print(f"api_key split: {api_key}") if len(api_key) > 0: api_key = api_key