Packages
OpenAI Python SDK 3.62.2: WebSockets 17, Health Alerts, and X.509 mTLS Architecture
Released December 2, 2026 on PyPI with full provenance, openai 3.62.2 completes a rapid seven-day sprint adding websockets 17 support in the realtime extra, ty 1.0.0 type-checking, health alert rules, spend limits, response compaction fields, and chunked webhook verification.
8 min read
OpenAI Python SDK 3.62.2: WebSockets 17, Health Alerts, and X.509 mTLS Architecture
Executive Summary
On December 2, 2026, OpenAI published openai v3.62.2 to PyPI and GitHub, capping a rapid seven-release sprint (v3.59.0 through v3.62.2) spanning November 24 to December 2, 2026. While v3.62.2 itself is a targeted patch enabling websockets 17 compatibility in the realtime extra (#4359), the surrounding minor releases introduce substantial production capabilities: ty 1.0.0 type-checking adoption (v3.62.1), health alert rules and notification retrieval (v3.62.0), gpt-6.2-sol example updates (v3.62.0), chunked webhook signature verification and Evals/saved-prompt deprecations (v3.61.0), spend alerts, response compaction fields, and session vaults (v3.60.0), alongside five security-hardening fixes in v3.59.0.
Beyond the changelog, the modern 3.x generation of the openai package marks a structural shift in Python transport and enterprise authentication. The SDK replaces legacy httpx with HTTPX2 (DefaultHttpx2Client and DefaultAsyncHttpx2Client) as its default HTTP transport, pairs it with an optional aiohttp backend (DefaultAioHttpClient) for high-concurrency async workloads, and ships first-class X.509 mutual TLS (mTLS), Kubernetes, Azure, and GCP workload identity providers alongside native Amazon Bedrock SigV4 support. For teams maintaining production AI services on Python 3.10 through 3.14, upgrading to v3.62.2 is straightforward—provided you account for deprecated Evals references and transport exception boundaries.
Adoption Telemetry & Version Changelog
The openai package on PyPI remains one of the most heavily downloaded libraries in the Python ecosystem. According to PyPI Download Stats, the package records 295,856,631 monthly downloads, 85,437,895 weekly downloads, and 13,966,308 daily downloads (note that pypistats.org metadata caches an older version tag while live PyPI serves 3.62.2). On GitHub, the repository holds 32.3k stars, 5.8k forks, 477 releases, and 1,962 commits under the Apache-2.0 license, supporting Python >=3.10 (with explicit classifiers through Python 3.14). Both the 2.4 MB source distribution (openai-3.62.2.tar.gz) and 2.5 MB universal wheel (openai-3.62.2-py3-none-any.whl) ship via Trusted Publishing (twine/7.0.0, CPython/3.13.16) with full GitHub Actions provenance attestations.
Seven-Day Release Sprint (v3.59.0 to v3.62.2)
The GitHub releases log shows how rapidly OpenAI's SDK automation (powered by Stainless and uv) iterates on OpenAPI schema updates and runtime fixes:
- v3.62.2 (December 2, 2026): Adds support for
websockets 17in therealtimeoptional extra (#4359, commit358c61e), unblocking projects upgrading WebSocket stacks without dependency resolver conflicts. - v3.62.1 (December 2, 2026): Upgrades the repository's
tystatic type-checker toolchain to1.0.0(#4356, commit7e007e7), aligning SDK type stubs with Astral's newly stabilized type checker. - v3.62.0 (December 1, 2026): Introduces API bindings for health alert rules and notification retrieval (
#4355), improves standalone examples with live checks (#4354), and updates official SDK examples togpt-6.2-sol(#4352). - v3.61.0 (November 30, 2026): Deprecates legacy Evals and saved prompt references (
#4351), honors module-levelbase_urloverrides for WebSocket connections (#4319), rechecks browser cancellation after approval callbacks (#4322), implements chunked webhook signature verification (#4324), and bumpswebsockets(15.0.1to16.1.1) and dev-dependencypydantic(1.10.26to2.14.3). - v3.60.0 (November 26, 2026): Adds spend alert bindings, response compaction fields (
#4335), and session vault updates (#4334), while clarifying Batch endpoint retry behavior and Realtime audio noise reduction docs. - v3.59.0 (November 24, 2026): Ships healthcare model IDs for the Responses API (
#4327) alongside five targeted security and validation fixes across agent uploads, error redaction, webhooks, and Realtime auth.
Security Hardening, Deprecations & Transport Internals
A closer look at v3.59.0 through v3.62.2 reveals a strong emphasis on defensive defaults and transport isolation. Rather than leaving validation to server-side rejections, the SDK now enforces strict client-side guards before payloads leave the process.
Security & Validation Fixes (v3.59.0–v3.61.0)
- Path Traversal & Agent Upload Guard (
#4323,v3.59.0): The SDK now validates the agent upload directory after path resolution rather than before, preventing symlink or relative-segment (..) escapes from bypassing upload directory boundaries. - Credential Header Redaction (
#4316,v3.59.0): WhenAPIStatusErroror connection errors occur, credential headers are explicitly redacted from error request objects so exception loggers and APM tools do not inadvertently persist bearer tokens. - Chunked & Strict Webhook Verification (
#4321inv3.59.0,#4324inv3.61.0): Empty webhook signing keys are now rejected immediately instead of silently failing or weakening HMAC checks, andclient.webhooks.verify_signature()/.unwrap()process signatures in chunks to reduce peak memory pressure on large webhook payloads. - Finite Numeric Enforcement (
#4326,v3.59.0): Non-finite floats (NaN,Infinity,-Infinity) in agent tool arguments are rejected client-side, avoiding invalid JSON serialization errors mid-run. - Realtime & Browser Approval Safety (
#4317,#4319,#4322): Beta Realtime sessions enforce bearer authentication (and X.509 mTLS clients are explicitly rejected on beta WebSockets even if custom headers are passed), WebSocket connections honor module-levelbase_urloverrides, and browser-based agent workflows recheck cancellation state after approval callbacks complete.
Deprecations & Exception Boundaries
In v3.61.0, OpenAI formally deprecated Evals and saved prompt references (#4351). Teams relying on those endpoints should audit client.evals or saved-prompt call sites and plan migration toward Responses API workflows.
Equally important is the HTTPX2 exception boundary. Because openai now defaults to httpx2, custom http_client wrappers must use DefaultHttpx2Client or DefaultAsyncHttpx2Client. When consuming a Stream or AsyncStream, read timeouts raise openai.APITimeoutError and other transport failures raise openai.APIConnectionError—with the underlying httpx2 exception preserved on __cause__. Stream consumption is intentionally never retried automatically (unlike unary requests, which retry twice by default on connection errors, 408, 409, 429, and >=500 responses) to avoid duplicating partial tokens already yielded to your application.
Production Configuration: X.509 mTLS & aiohttp Transport
For zero-trust enterprise deployments, openai supports X.509 workload identity (mTLS) using a dedicated DefaultAsyncHttpx2Client or DefaultHttpx2Client with follow_redirects=False so client certificates cannot leak to another origin:
import os
import ssl
import asyncio
from openai import AsyncOpenAI, DefaultAsyncHttpx2Client
from openai.auth import x509_workload_identity
def build_mtls_client() -> AsyncOpenAI:
tls_context = ssl.create_default_context(
cafile=os.environ.get("OPENAI_MTLS_CA_BUNDLE"),
)
# PEM must list the leaf certificate first, followed by intermediates
tls_context.load_cert_chain(
certfile=os.environ["OPENAI_MTLS_CERTIFICATE_CHAIN"],
keyfile=os.environ["OPENAI_MTLS_PRIVATE_KEY"],
password=os.environ.get("OPENAI_MTLS_PRIVATE_KEY_PASSWORD"),
)
return AsyncOpenAI(
workload_identity=x509_workload_identity(
identity_provider_id=os.environ["OPENAI_IDENTITY_PROVIDER_ID"],
service_account_id=os.environ["OPENAI_SERVICE_ACCOUNT_ID"],
refresh_buffer_seconds=120.0,
),
http_client=DefaultAsyncHttpx2Client(
verify=tls_context,
follow_redirects=False,
),
)
async def main() -> None:
async with build_mtls_client() as client:
response = await client.responses.create(
model="gpt-6.2-sol",
input="Verify mTLS workload identity handshake.",
)
print(response.output_text)
asyncio.run(main())
Note two operational constraints documented in the PyPI package README:
- Leaf-first PEM chains: OpenAI does not fetch missing intermediate certificates via AIA, so supply the complete leaf-first chain in
OPENAI_MTLS_CERTIFICATE_CHAIN(and rotate by building a freshSSLContext, HTTP client, and SDK client rather than expecting existing TLS connections to renegotiate). - High-concurrency async alternative: If you use standard API keys or cloud workload identity (Kubernetes, Azure, GCP) instead of X.509 mTLS and need higher concurrency throughput, install
pip install openai[aiohttp]and passhttp_client=DefaultAioHttpClient()toAsyncOpenAI.
Ecosystem Comparison & Upgrade Checklist
How does openai 3.62.2 compare against its two primary frontier-model Python SDK peers as of early December 2026? All three official SDKs have converged on Python >=3.10 and Apache-2.0 licensing, while diverging on transport defaults and enterprise auth ergonomics:
| Dimension | openai (3.62.2) |
anthropic (2.16.0) |
google-genai (v3.x) |
|---|---|---|---|
| Latest Release (Verified) | Dec 2, 2026 (PyPI) | Nov 30 / Dec 1, 2026 (PyPI) | Major v3+ (PyPI) |
| License & Python Floor | Apache-2.0, Python >=3.10 |
Apache-2.0, Python >=3.10 |
Apache-2.0, Python >=3.10 |
| GitHub / PyPI Scale | 32.3k stars, 295.9M/mo PyPI |
4,120 stars (PyPI metadata) |
Official Google Gen AI SDK |
| Default HTTP Transport | httpx2 (+ optional aiohttp) |
Standard SDK HTTP transport | httpx2 (optional [httpx] fallback) |
| Primary Text API | client.responses.create() |
client.messages.create() |
Gemini Developer v1 / Vertex v1beta1 |
| Enterprise / Cloud Auth | X.509 mTLS, K8s/Azure/GCP, Bedrock SigV4 | Anthropic API, Bedrock, Vertex | Gemini API Key, Vertex AI IAM |
Notice a notable convergence across the Python AI ecosystem: both openai 3.x and google-genai 3.x have migrated away from dormant httpx 0.28.x to HTTPX2 (httpx2), Pydantic Services Inc.'s actively maintained fork. If your application imports both SDKs in the same virtual environment, pinning httpx2 >= 2.16.2 avoids Union type-alias TypeError/SyntaxError bugs present in httpx2 2.16.1 and keeps TLS trust behavior consistent across OS certificate stores.
Upgrade Checklist for openai 3.62.2
Before bumping openai==3.62.2 in pyproject.toml or requirements.txt, run through these verification steps:
- Check Python &
websocketspins: Confirm your runtime is Python3.10–3.14. If you installopenai[realtime], you can now safely upgrade towebsockets 17without resolver conflicts (#4359). - Audit HTTPX2 imports: Replace any custom
httpx.Client,httpx.Timeout, or mock transport hooks withhttpx2equivalents (DefaultHttpx2Client/DefaultAsyncHttpx2Client) and catchopenai.APITimeoutError/openai.APIConnectionErroron streams. - Scan for deprecated Evals & saved prompts: Search your codebase for
client.evalsor saved prompt reference parameters deprecated inv3.61.0(#4351). - Verify webhook secret non-emptiness: Ensure
OPENAI_WEBHOOK_SECRETis strictly non-empty in all staging and CI environments, asv3.59.0+rejects empty signing keys (#4321). - Use
async withforAsyncOpenAI: Always close async clients explicitly viaasync with AsyncOpenAI() as client:orawait client.close()before event-loop shutdown, because garbage collection cannot reliably await async connection teardown. - Verify PyPI Provenance in CI: For regulated pipelines, validate PyPI Trusted Publishing attestations (
twine/7.0.0,github.com/openai/openai-python) when mirroringopenai-3.62.2-py3-none-any.whl.
Frequently Asked Questions
What changed in openai 3.62.2 compared to 3.62.0 and 3.62.1?
openai 3.62.2 (December 2, 2026) is a targeted bug-fix release adding websockets 17 compatibility to the realtime extra (#4359). v3.62.1 (December 2, 2026) upgraded the SDK's ty type-checker dependency to 1.0.0 (#4356), while v3.62.0 (December 1, 2026) added health alert rules, notification retrieval (#4355), and gpt-6.2-sol examples (#4352).
Why does openai use httpx2 instead of httpx, and can I still use aiohttp?
openai 3.x uses httpx2 as its default synchronous and asynchronous HTTP client because httpx was largely dormant prior to its recent fork maintenance. For higher async concurrency, you can install pip install openai[aiohttp] and pass http_client=DefaultAioHttpClient() to AsyncOpenAI without changing your API calls.
Does X.509 mTLS workload identity work with the Realtime WebSocket API?
No. According to the PyPI documentation, X.509 workload identity supports HTTP APIs only. Beta Realtime WebSockets explicitly reject X.509 clients even when custom authorization headers are supplied.
Why did my webhooks.unwrap() call start failing after upgrading?
Starting in v3.59.0 (#4321), the SDK rejects empty webhook signing keys rather than allowing blank secrets. Make sure you pass the raw, unparsed JSON request body string to client.webhooks.unwrap(request_body, request.headers) alongside a non-empty OPENAI_WEBHOOK_SECRET.
How do I use the openai SDK with Amazon Bedrock without changing my response parsing?
Install pip install 'openai[bedrock]' and initialize OpenAI(provider=bedrock(region="us-west-2")). The provider automatically configures AWS SigV4 signing and the Bedrock Mantle endpoint while preserving standard client.responses.create() streaming, retries, and error classes.
Sources
- PyPI —
openai 3.62.2Package Page & Provenance (Accessed December 2, 2026): https://pypi.org/project/openai/ - GitHub —
openai/openai-pythonReleases (v3.55.1–v3.62.2) (Accessed December 2, 2026): https://github.com/openai/openai-python/releases - GitHub —
openai/openai-pythonRepository Overview & Stats (Accessed December 2, 2026): https://github.com/openai/openai-python - PyPI Stats —
openaiDownload Telemetry (Accessed December 2, 2026): https://pypistats.org/packages/openai - PyPI —
anthropic 2.16.0Package Page (Accessed December 2, 2026): https://pypi.org/project/anthropic/ - PyPI —
google-genaiPackage Page (Accessed December 2, 2026): https://pypi.org/project/google-genai/