Skip to content

Commit 634948b

Browse files
committed
fix: when api_key is None, the request should not contain 'Authorization': f 'Bearer {api_key}'. openai#961
1 parent 62f3a1b commit 634948b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/openai/_client.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ def __init__(
110110
"""
111111
if api_key is None:
112112
api_key = os.environ.get("OPENAI_API_KEY")
113-
if api_key is None:
114-
raise OpenAIError(
115-
"The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
116-
)
113+
117114
self.api_key = api_key
118115

119116
if organization is None:
@@ -343,10 +340,7 @@ def __init__(
343340
"""
344341
if api_key is None:
345342
api_key = os.environ.get("OPENAI_API_KEY")
346-
if api_key is None:
347-
raise OpenAIError(
348-
"The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
349-
)
343+
350344
self.api_key = api_key
351345

352346
if organization is None:

0 commit comments

Comments
 (0)