[pull] main from openai:main - #126
Merged
Merged
Conversation
Makes HTTPX2 the default HTTP client for the next major Python SDK release. See the [HTTPX Migration Guide](https://github.com/openai/openai-python/blob/2e4a69261f6c2b7c9038a4ff34d2a329d3680417/httpx2.md) for complete customer-facing migration instructions. ## Customer migration - **Default clients:** `OpenAI()` and `AsyncOpenAI()` use HTTPX2 automatically; API calls, parsed responses, streaming, retries, authentication, and numeric timeouts retain their existing interfaces. - **Dependencies:** `pip install openai` installs HTTPX2 instead of HTTPX. Applications importing `httpx` through the SDK's former transitive dependency must migrate to `httpx2` or install `httpx` explicitly. - **TLS trust store:** HTTPX2 uses the operating-system trust store instead of `certifi`. This can break certificate verification even with the default client; configure the system trust store, `SSL_CERT_FILE`, `SSL_CERT_DIR`, or a custom `ssl.SSLContext` as needed. - **Custom HTTP integrations:** Migrate custom clients, transports, timeout objects, authentication handlers, hooks, request mocks, and instrumentation to their HTTPX2 equivalents. Raw requests, responses, and transport exceptions are now HTTPX2 objects. - **aiohttp:** `openai[aiohttp]` and `DefaultAioHttpClient()` remain supported through an HTTPX2-native transport without installing HTTPX or `httpx-aiohttp`. - **Legacy escape hatch:** Explicitly installed `httpx.Client`, `httpx.AsyncClient`, and `httpx-aiohttp` clients remain supported when passed through `http_client`. **This compatibility is runtime-only; legacy clients are not supported by static type checkers such as mypy or Pyright.** Legacy HTTPX support is provided as a migration aid and may be discontinued. See [httpx2.md](https://github.com/openai/openai-python/blob/2e4a69261f6c2b7c9038a4ff34d2a329d3680417/httpx2.md) for examples and detailed migration cases. ## Implementation notes - Replace the SDK’s default clients and HTTP-facing types with HTTPX2. - Test legacy HTTPX and aiohttp compatibility separately, including a real request through the legacy aiohttp adapter. **Vendored dependencies** We've vendored a few dependencies in so that we can avoid installing `httpx` by default for both normal dependencies and dev dependencies. This was the fastest path to unblock migration; we are happy to upstream these changes if it makes sense for those package's dependencies. - Fork RESPX under `tests/respx2` so existing request-mocking tests work without HTTPX. - This is for convenience so we can mechanically rewrite tests. - Vendor the upstream HTTPX2 aiohttp adapter, including its original license and attribution. - This is to avoid `aiohttp` bringing in `httpx` by default for now. **Issues** - #3375 Co-authored-by: apcha-oai <228803254+apcha-oai@users.noreply.github.com>
Automated Release PR --- ## [3.0.0](v2.54.0...v3.0.0) (2026-08-12) ### ⚠ BREAKING CHANGES * **api:** HTTPX2 is now the default HTTP client, and `httpx` is no longer installed automatically. Applications using custom HTTPX clients, transports, or configuration objects must migrate to their HTTPX2 equivalents or use the temporary, runtime-only legacy HTTPX escape hatch. See the [HTTPX2 migration guide](https://github.com/openai/openai-python/blob/main/httpx2.md). ### Features * **api:** migrate to HTTPX2 ([#3594](#3594)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: openai-sdks[bot] <284451331+openai-sdks[bot]@users.noreply.github.com> Co-authored-by: apcha-oai <228803254+apcha-oai@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )