forked from phoenix/litellm-mirror
build(litellm_server/main.py): support azure api key header
This commit is contained in:
parent
c9956e95c6
commit
e3556494b3
1 changed files with 2 additions and 1 deletions
|
@ -104,7 +104,8 @@ async def chat_completion(request: Request, model: Optional[str] = None):
|
|||
## CHECK KEYS ##
|
||||
# default to always using the "ENV" variables, only if AUTH_STRATEGY==DYNAMIC then reads headers
|
||||
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
|
||||
print(f"request headers: {request.headers}")
|
||||
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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue