Skip to content

Commit 2a83d30

Browse files
committed
rebuild
1 parent fc68c57 commit 2a83d30

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

openai/init.lua

+4-3
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ do
349349
_request = function(self, method, path, payload, more_headers, stream_fn)
350350
assert(path, "missing path")
351351
assert(method, "missing method")
352-
assert(self.api_key, "missing api_key")
353352
local url = self.api_base .. path
354353
local body
355354
if payload then
@@ -359,9 +358,11 @@ do
359358
["Host"] = parse_url(self.api_base).host,
360359
["Accept"] = "application/json",
361360
["Content-Type"] = "application/json",
362-
["Content-Length"] = body and #body or nil,
363-
["Authorization"] = "Bearer " .. tostring(self.api_key)
361+
["Content-Length"] = body and #body or nil
364362
}
363+
if self.api_key then
364+
headers["Authorization"] = "Bearer " .. tostring(self.api_key)
365+
end
365366
if more_headers then
366367
for k, v in pairs(more_headers) do
367368
headers[k] = v

0 commit comments

Comments
 (0)