Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,25 @@ with OpenAI() as client:
# HTTP client is now closed
```

For `AsyncOpenAI`, use `async with` or `await client.close()` before shutting down
the event loop. Garbage collection cannot reliably await asynchronous cleanup.

```py
import asyncio
from openai import AsyncOpenAI


async def main() -> None:
async with AsyncOpenAI() as client:
response = await client.responses.create(
model="gpt-5.5", input="Say this is a test"
)
print(response.output_text)


asyncio.run(main())
```

## Microsoft Azure OpenAI

To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI`
Expand Down
Loading