forked from phoenix/litellm-mirror
(fix) make setting keys in header optional
This commit is contained in:
parent
e1b873a2a0
commit
e61d8c7255
1 changed files with 4 additions and 4 deletions
|
@ -60,10 +60,10 @@ async def completion(request: Request):
|
|||
async def chat_completion(request: Request):
|
||||
try:
|
||||
data = await request.json()
|
||||
|
||||
api_key = request.headers.get("authorization")
|
||||
api_key = api_key.split(" ")[1]
|
||||
data["api_key"] = api_key
|
||||
if "authorization" in request.headers: # if users pass LLM api keys as part of header
|
||||
api_key = request.headers.get("authorization")
|
||||
api_key = api_key.split(" ")[1]
|
||||
data["api_key"] = api_key
|
||||
response = litellm.completion(
|
||||
**data
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue