mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
build(litellm_server/main.py): updates
This commit is contained in:
parent
e3556494b3
commit
3e66fb2a83
1 changed files with 2 additions and 1 deletions
|
@ -108,6 +108,7 @@ 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
|
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")
|
api_key = request.headers.get("authorization")
|
||||||
print(f"api_key in headers: {api_key}")
|
print(f"api_key in headers: {api_key}")
|
||||||
|
if " " in api_key:
|
||||||
api_key = api_key.split(" ")[1]
|
api_key = api_key.split(" ")[1]
|
||||||
print(f"api_key split: {api_key}")
|
print(f"api_key split: {api_key}")
|
||||||
if len(api_key) > 0:
|
if len(api_key) > 0:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue