Skip to content

Commit

Permalink
fix: boost to support bearer auth
Browse files Browse the repository at this point in the history
  • Loading branch information
av committed Sep 25, 2024
1 parent 0062761 commit fbe9ff4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions boost/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
async def get_api_key(api_key_header: str = Security(auth_header)):
if len(BOOST_AUTH) == 0:
return
if api_key_header in BOOST_AUTH:
return api_key_header
# Bearer/plain versions
value = api_key_header.replace("Bearer ", "").replace("bearer ", "")
if value in BOOST_AUTH:
return value
raise HTTPException(status_code=403, detail="Unauthorized")


Expand Down
4 changes: 2 additions & 2 deletions http-catalog/boost.http
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GET {{host}}/v1/models

POST {{host}}/v1/chat/completions
Content-Type: application/json
Authorization: sk-fake
Authorization: Bearer sk-boost

{
"model": "klmbr-llama3.1:8b",
Expand All @@ -30,7 +30,7 @@ Authorization: sk-fake

POST {{host}}/v1/chat/completions
Content-Type: application/json
Authorization: sk-fake
Authorization: sk-boost

{
"model": "klmbr-llama3.1:8b",
Expand Down

0 comments on commit fbe9ff4

Please sign in to comment.