From 9eb53acd8ec2a7bf578ccdab44582a95fd9b0513 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 28 Oct 2023 13:25:22 -0700 Subject: [PATCH] build(litellm_server/main.py): make /chat/completions azure compatible --- litellm_server/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm_server/main.py b/litellm_server/main.py index 7bbe408d7..fd49e6870 100644 --- a/litellm_server/main.py +++ b/litellm_server/main.py @@ -106,7 +106,7 @@ async def chat_completion(request: Request, model: Optional[str] = None): env_validation = litellm.validate_environment(model=data["model"]) if (env_validation['keys_in_environment'] is False or os.getenv("AUTH_STRATEGY", None) == "DYNAMIC") and "authorization" in request.headers: # if users pass LLM api keys as part of header api_key = request.headers.get("authorization") - api_key = api_key.replace("Bearer", "").strip() + api_key = api_key.split(" ")[1] if len(api_key) > 0: api_key = api_key data["api_key"] = api_key