Skip to content

Commit fc68c57

Browse files
johnd0eleafo
authored andcommitted
Do not demand authorization
It is common case for local models usage
1 parent 08128b9 commit fc68c57

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

openai/init.moon

+3-3
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,6 @@ class OpenAI
366366
assert path, "missing path"
367367
assert method, "missing method"
368368

369-
assert @api_key, "missing api_key"
370-
371369
url = @api_base .. path
372370

373371
body = if payload
@@ -378,9 +376,11 @@ class OpenAI
378376
"Accept": "application/json"
379377
"Content-Type": "application/json"
380378
"Content-Length": body and #body or nil
381-
"Authorization": "Bearer #{@api_key}"
382379
}
383380

381+
if @api_key
382+
headers["Authorization"] = "Bearer #{@api_key}"
383+
384384
if more_headers
385385
for k,v in pairs more_headers
386386
headers[k] = v

0 commit comments

Comments
 (0)