Technology
OpenAI Python SDK migrates to HTTPX2
The transition replaces the legacy httpx package and updates the SDK's default TLS trust store to use operating-system settings.
The short version
- The OpenAI Python SDK has transitioned to HTTPX2 for its synchronous and asynchronous HTTP clients, automatically installing HTTPX2 instead of the previous httpx package.
- This update changes the default TLS trust store from certifi to the operating-system trust store, which may require developers using minimal container images or corporate proxies to manually configure CA certificates.
- A temporary runtime escape hatch is available for applications that still rely on legacy HTTPX-only integrations or mocking libraries.
Key facts
- The OpenAI Python SDK now automatically installs and uses HTTPX2 for its default HTTP clients, meaning installing the SDK no longer automatically installs the legacy httpx package.[Hacker News]
- HTTPX2 changes the default TLS trust store by using the operating-system trust store instead of the CA bundle previously provided by certifi, which the SDK no longer installs.[Hacker News]
- Developers can manually configure custom CA certificates using environment variables like SSL_CERT_FILE or SSL_CERT_DIR, or by explicitly passing an ssl.SSLContext.[Hacker News]
- Test suites utilizing mocking libraries like RESPX must upgrade to an HTTPX2-compatible version or use a legacy client workaround to intercept request traffic.[Hacker News]
- Legacy HTTPX clients can still be injected using explicit installs and type casts as a temporary migration aid, though this path bypasses static type checking and may be discontinued in the future.[Hacker News]
Sources
- OpenAI: Migrating to HTTPX2Hacker News