Skip to content

Commit

Permalink
Do not demand authorization
Browse files Browse the repository at this point in the history
It is common case for local models usage
  • Loading branch information
johnd0e authored and leafo committed Apr 17, 2024
1 parent 08128b9 commit fc68c57
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions openai/init.moon
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,6 @@ class OpenAI
assert path, "missing path"
assert method, "missing method"

assert @api_key, "missing api_key"

url = @api_base .. path

body = if payload
Expand All @@ -378,9 +376,11 @@ class OpenAI
"Accept": "application/json"
"Content-Type": "application/json"
"Content-Length": body and #body or nil
"Authorization": "Bearer #{@api_key}"
}

if @api_key
headers["Authorization"] = "Bearer #{@api_key}"

if more_headers
for k,v in pairs more_headers
headers[k] = v
Expand Down

0 comments on commit fc68c57

Please # to comment.