Skip to content

Commit c2a3cd5

Browse files
chore(docs): use environment variables for authentication in code snippets
1 parent 575bbac commit c2a3cd5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,15 @@ pip install openai[aiohttp]
160160
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
161161

162162
```python
163+
import os
163164
import asyncio
164165
from openai import DefaultAioHttpClient
165166
from openai import AsyncOpenAI
166167

167168

168169
async def main() -> None:
169170
async with AsyncOpenAI(
170-
api_key="My API Key",
171+
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
171172
http_client=DefaultAioHttpClient(),
172173
) as client:
173174
chat_completion = await client.chat.completions.create(

0 commit comments

Comments
 (0)