Skip to content
Tech News
← Back to articles

Migrating to HTTPX2

read original more articles
Why This Matters

The migration to HTTPX2 in the OpenAI Python SDK marks a significant shift in how applications handle HTTP communications, emphasizing improved security and compatibility by relying on the operating system's trust store instead of certifi. This change enhances performance and security but requires developers to update their dependencies and trust configurations, especially in minimal or custom environments. Overall, this update underscores the importance of staying current with SDK changes to ensure seamless and secure integrations.

Key Takeaways

Migrating to HTTPX2

The OpenAI Python SDK now uses HTTPX2 for its synchronous and asynchronous HTTP clients. HTTPX2 is installed automatically with openai ; the previous httpx package is not. This guide explains what changes for applications that interact with the SDK's HTTP layer.

If you use the SDK's default HTTP client

If you construct an OpenAI or AsyncOpenAI client without providing http_client , your existing API calls, parsed response models, streaming APIs, authentication, retries, and numeric timeouts continue to work:

from openai import OpenAI client = OpenAI ( timeout = 30.0 ) response = client . responses . create ( model = "gpt-5.5" , input = "Hello" )

No HTTPX2 extra or separate installation is required:

pip install openai

If your application imported httpx only because an earlier SDK installed it transitively, add your own httpx dependency or migrate those imports to httpx2 . Installing the SDK no longer installs httpx for you.

TLS certificates and trust stores

HTTPX2 changes the default TLS trust store, including for applications that use the SDK's default HTTP client. HTTPX previously verified certificates against the CA bundle provided by certifi . HTTPX2 instead uses the operating-system trust store, and the SDK no longer installs certifi .

... continue reading