openai/openai-python
66.9
Adequate · 18 September 2026
161k
lines of production code
Python
primary language
1
measurement over time
What this system is
This system is the official OpenAI Python SDK, serving as a client library for interacting with OpenAI's API services. It provides programmatic access to a wide range of capabilities, including chat completions, audio processing, fine-tuning, and new interfaces like the Responses and Realtime APIs. The library supports both synchronous and asynchronous operations, featuring robust streaming helpers, structured output parsing, and comprehensive type definitions for API resources.
How it got here
2020–2023 — httpx2 migration and API modernization
34 changes.
The SDK underwent a major architectural rewrite to migrate from httpx to httpx2, introducing new client defaults, data residency support, and lazy-loading for optional dependencies. This period focused on expanding the API surface with new resources like Agents, Responses, and fine-tuning methods, while deprecating the legacy Assistants API. Comprehensive test coverage and governance frameworks were established to support these structural changes and new model integrations.
2024–2025 — Responses API and Realtime expansion
40 changes.
This period focused on integrating the new Responses API and Realtime API, including dedicated streaming helpers, structured output parsing, and comprehensive type definitions. The SDK also expanded support for fine-tuning, vector stores, containers, and conversations, while migrating development tooling to uv and Steady.
2026 — Admin API, Live API, and Agents expansion
17 changes.
This period focused on expanding the SDK's API surface with new resources for organization administration, real-time voice sessions via the Live API, and beta Agents management. It also introduced webhook endpoint handling, X.509 workload identity authentication, and safety alert monitoring. The work included significant updates to build tooling and validation scripts to ensure maintainability and reproducibility.
Features
Add Live API resource for real-time voice sessions
The \src/openai/resources/live\ module now exposes the Live API, enabling users to create and manage real-time voice sessions via WebRTC and WebSocket. This includes methods to create sessions (\client.live.create\), connect to live streams, and manage session lifecycles through sub-resources: \sessions\ (for accepting SIP calls, forking sessions, downloading recordings, and hanging up), \forks\ (for forking stored sessions), and \sideband\ (for attaching to existing sessions).
src/openai/resources/live · high confidence
Add Realtime API support with session and transcription session management
The SDK now exposes the Realtime API under the beta namespace, providing \Realtime\ and \AsyncRealtime\ resources that allow users to establish WebSocket connections for low-latency, multi-modal conversations. This update introduces dedicated \Sessions\ and \TranscriptionSessions\ resources, enabling the creation of ephemeral API tokens and the configuration of session parameters such as audio formats, voices, turn detection, and tool usage. The implementation relies on the \httpx2\ HTTP client and supports both synchronous and asynchronous operations, including raw and streaming response access.
src/openai/resources/beta/realtime · high confidence
Add Realtime API type definitions
The \src/openai/types/beta/realtime\ module now exposes the complete set of Python type definitions for the Realtime API, including session configuration, client and server event parameters, and conversation item structures. This enables users to interact with the Realtime API using strongly-typed parameters for session creation, audio buffer management, and response handling.
src/openai/types/beta/realtime · high confidence
Add local audio recording and playback helpers
New helper classes \Microphone\ and \LocalAudioPlayer\ are now available in \src/openai.helpers\ to enable local audio capture and playback. The \Microphone\ class records audio from the system input and can return the data as a NumPy array or a WAV file, while \LocalAudioPlayer\ plays audio data (either as NumPy arrays or streamed binary responses) through the system output. These utilities rely on the \sounddevice\ and \numpy\ libraries, which are now treated as optional extras.
src/openai/helpers · high confidence
Add webhook endpoint management and event type listing
The \src/openai/resources/webhooks\ module is introduced, providing a new API surface for managing webhook endpoints and discovering available event types. Users can now create, retrieve, update, list, and delete webhook endpoints via \client.webhooks\, and list supported event types via \client.webhooks.event\_types\. The implementation includes support for raw and streaming responses, signature verification for incoming webhooks, and specific event types such as batch, response, eval, fine-tuning, realtime, video, and safety alerts.
src/openai/resources/webhooks · high confidence
Added multi-agent streaming examples for the Responses API
New example scripts in the \examples/responses\ directory demonstrate how to use the multi-agent feature with the Responses API. \multi\_agent\_streaming.py\ shows how to stream responses using the standard HTTP client, while \multi\_agent\_websocket.py\ illustrates the same capability using the WebSocket connection. Both examples configure the \multi\_agent\ parameter and handle event streams to label and display output from individual agents versus the coordinator.
examples/responses · high confidence
Added type definitions for Vector Store file and file batch operations
New TypedDict parameter types have been generated for managing files within vector stores, including \FileCreateParams\, \FileUpdateParams\, \FileListParams\, \FileBatchCreateParams\, and \FileBatchListFilesParams\. These definitions support batch ingestion of files (with a documented limit of 2000 files per batch), allow filtering and pagination of file statuses (in\_progress, completed, failed, cancelled), and enable the attachment of structured metadata attributes to individual files or entire batches.
_src/openai/types/vector\stores · high confidence
Added type definitions for organization and project role management
New generated Python type definitions have been added to support managing roles at both the organization and project levels. This includes parameter and response types for listing, creating, retrieving, and deleting roles for users and groups within projects, as well as role management for organization users. These types enable developers to interact with the updated API endpoints for assigning and querying role assignments.
src/openai/types/admin/organization/projects/groups, src/openai/types/admin/organization/projects/users, src/openai/types/admin/organization/users · high confidence
Audio resources restructured with new Speech API and updated Transcription models
The audio resource module has been reorganized into dedicated sub-modules (speech, transcriptions, translations) and now exposes a new Speech API for text-to-audio generation alongside updated Transcription and Translation endpoints. The Speech API supports multiple output formats (mp3, opus, aac, flac, wav, pcm) and streaming, while Transcriptions now include support for diarization, word-level timestamps, and new GPT-based models. The module also introduces raw and streaming response wrappers for all audio operations.
src/openai/resources/audio · high confidence
Beta API types now include Agent, Responses, and MCP tooling schemas
The \src/openai/types/beta\ package has been expanded with generated type definitions for the new Agent API (including \AgentCreateParams\, \AgentUpdateParams\, and \AgentSessionEvent\ for streaming session events), the Responses API (\ResponseCreateParams\, \BetaResponseItem\), and Model Context Protocol (MCP) integration (\McpTransport\, \AgentToolConfigParamMcp\). These additions provide the necessary type safety and parameter structures for interacting with these beta features.
src/openai/types/beta · high confidence
Initial release of generated Assistants API type definitions
The \src/openai/types/beta/threads\ package is now available, providing the complete set of generated Python types for the Assistants API. This includes parameter models for creating and updating threads, messages, and runs, as well as response models for message and run content (text, images, file citations, and refusals). The package also exposes types for run steps, tool calls (code interpreter, file search, and function), and streaming deltas, enabling type-safe interaction with the beta Assistants API.
src/openai/types/beta/threads · high confidence
Introduce Live API support with transcript grouping and audio examples
The SDK now includes a new Live API feature, providing the \TranscriptGrouper\ and \AsyncTranscriptGrouper\ helpers in \src/openai/lib/live\ to aggregate real-time audio transcripts into user and assistant segments. This release also adds a comprehensive set of type definitions for Live session events and configurations in \src/openai/types/live\, along with example scripts in \examples/live\ that demonstrate how to stream audio and process live transcripts.
examples/live, src/openai/lib/live, src/openai/types/live · high confidence
Introduce beta Agents API with sessions, environments, and vaults
This release adds the beta Agents API, providing new resource classes for managing Agents, Sessions, Environments, and Vaults. Users can now create and configure reusable agents (including multi-agent and reasoning settings), manage execution environments with templates and files, and interact with agent sessions by submitting events, streaming live updates, and listing session items and artifacts. The implementation includes both synchronous and asynchronous client support, along with raw and streaming response wrappers for all endpoints.
src/openai/resources/beta/agents, src/openai/types/beta/agents · high confidence
Introduce custom-code budget gate to limit SDK customization
A new custom-code budgeting system has been added to the SDK to prevent accidental growth of handwritten modifications to generated files. This change introduces a budget policy file (\.castiron-ratchet.json\) and a trusted CI workflow pair that measures the total lines added and deleted in generated files against a configurable limit. The system enforces isolation, requiring budget changes to be submitted in separate PRs, and uses a trusted checkout to compute the authoritative report without executing candidate code. This acts as a guardrail to maintain the SDK's maintainability by tracking and capping the extent of custom patches.
scripts/castiron · high confidence
Introduces structured output parsing for chat completions, responses, audio, and embeddings
The SDK now includes a new \\_parsing\ library that automatically parses API responses into user-defined types. For chat completions and the new Responses API, function tool arguments are automatically deserialized into Pydantic models or dataclasses when strict function tools are used, and text content can be parsed into structured formats. Audio transcription and translation responses are typed based on the requested format (e.g., \verbose\_json\), and embedding responses are automatically converted from base64 strings to float arrays, optimizing performance with NumPy when available.
_src/openai/lib/\parsing · high confidence
New Admin API resource module for organization management
The \src/openai/resources/admin\ package has been added, providing a generated client interface for the OpenAI Admin API. This module exposes \Admin\ and \Organization\ resource classes that allow programmatic management of organization-level configurations, including users, groups, roles, API keys, audit logs, certificates, data retention, and spend limits.
src/openai/resources/admin · high confidence
New Alpha Fine-Tuning Graders API support
This update introduces a new \alpha\ sub-resource under fine-tuning, exposing \Graders\ classes for both synchronous and asynchronous clients. Users can now interact with the fine-tuning grader endpoints to run and validate graders against model samples and dataset items via the \run\ and \validate\ methods. The implementation is generated from the OpenAPI spec and utilizes the \httpx2\ library for HTTP requests.
_src/openai/resources/fine\tuning/alpha · high confidence
New Beta API resources for Agents, Responses, and ChatKit
The \src/openai/resources/beta\ module now exposes dedicated resource classes for the Agents API, the new Responses API, and the ChatKit, alongside the existing Assistants and Threads resources. Users can now access these capabilities via \client.beta.agents\, \client.beta.responses\, and \client.beta.chatkit\, with full support for both synchronous and asynchronous operations, as well as raw and streaming response wrappers.
src/openai/resources/beta · high confidence
New Beta Responses API resource with input item and token counting support
The SDK now exposes a dedicated \beta.responses\ resource for interacting with the OpenAI Responses API. This addition introduces methods to list input items for a specific response and to calculate input token counts for a conversation or set of inputs. The implementation is generated from the OpenAPI specification and supports both synchronous and asynchronous clients, including raw response access and streaming capabilities.
src/openai/resources/beta/responses · high confidence
New ChatKit beta resource for session and thread management
The SDK now exposes a new \ChatKit\ resource under the beta namespace, providing structured access to ChatKit sessions and threads. Users can create, cancel, and manage sessions, as well as list, retrieve, and delete threads and their items. This resource is built on the new \httpx2\ HTTP client and includes support for raw and streaming responses, allowing for flexible integration with the ChatKit beta API.
src/openai/resources/beta/chatkit · high confidence
New Container Files API resource
The SDK now exposes a dedicated \files\ resource under the \containers\ namespace, enabling users to manage files within containers. This addition provides methods to list, create, and retrieve container files, as well as a \content\ sub-resource to fetch the actual binary content of a file. The implementation supports both synchronous and asynchronous clients, including options for raw response access and streaming responses.
src/openai/resources/containers/files · high confidence
New Containers API resource for managing containerized environments
Users can now interact with the Containers API to create, list, and retrieve containers. This new resource supports configuring container properties such as memory limits, network policies, and associated skills, and allows files to be copied into the container upon creation. The implementation uses the httpx2 HTTP client and exposes both synchronous and asynchronous interfaces for these operations.
src/openai/resources/containers · high confidence
New Conversations API resource with item management
The SDK now exposes a dedicated \conversations\ resource, allowing users to create, retrieve, update, and delete conversations via the \/conversations\ endpoint. This resource also includes a nested \items\ sub-resource for managing conversation items (create, retrieve, list, delete) within a specific conversation context. The implementation is generated from the OpenAPI spec and utilizes the \httpx2\ HTTP client library.
src/openai/resources/conversations · high confidence
New Conversations API type definitions
The SDK now includes generated type definitions for the new Conversations API in \src/openai/types/conversations\. This adds support for creating and updating conversations with initial items and metadata, managing conversation items (listing, creating, retrieving) with pagination and specific field inclusion (such as web search sources, code interpreter outputs, and reasoning tokens), and handling various content types including text, images, files, and computer screenshots.
src/openai/types/conversations · high confidence
New Evals API grader types and parameters
The SDK now includes generated type definitions for the Evals API graders, enabling users to configure automated evaluation logic. This release adds support for five distinct grader types: \StringCheckGrader\ for exact or pattern-based string comparisons, \TextSimilarityGrader\ for metric-based comparisons (e.g., cosine, BLEU, ROUGE), \PythonGrader\ for executing custom Python scripts, \ScoreModelGrader\ for model-assigned numerical scores with configurable sampling parameters, and \LabelModelGrader\ for model-assigned categorical labels. It also introduces \MultiGrader\ to combine multiple graders into a single score and \GraderInputs\ to handle complex input structures including text, images, and audio.
src/openai/types/graders · high confidence
New Evals API resource for managing model evaluations
The SDK now includes a new \evals\ resource under \src/openai/resources/evals\, enabling users to programmatically manage model evaluations. This addition provides classes for creating evaluations with specific data sources and testing criteria, listing and retrieving evaluation details, and managing evaluation runs (including creating, listing, and retrieving runs and their output items). The implementation is generated from the OpenAPI spec and utilizes the \httpx2\ HTTP client.
src/openai/resources/evals · high confidence
New Evals API type definitions for run management and data sources
The SDK now includes generated type definitions for the Evals API in \src/openai/types/evals\, enabling users to programmatically create and manage evaluation runs. This addition introduces parameter types for configuring data sources via JSONL files or stored completions, as well as detailed schemas for input message templates that support text, images, and audio. It also provides types for listing and retrieving runs and their output items, including filtering by status and pagination support.
src/openai/types/evals · high confidence
New Realtime API examples for OpenAI and Azure
Added new example scripts in the \examples/realtime\ directory to demonstrate the Realtime API. This includes \realtime.py\ for basic text-based interaction with the OpenAI Realtime API, \azure\_realtime.py\ showing how to connect to Azure OpenAI using Entra ID authentication, and \push\_to\_talk\_app.py\, a terminal user interface (TUI) application using the \textual\ library that supports push-to-talk audio input and playback via \sounddevice\ and \pyaudio\. A new \audio\_util.py\ module provides helper classes for asynchronous audio streaming and conversion, and a \uv\ lock file (\push\_to\_talk\_app.py.lock\) is included to manage dependencies for the audio application.
examples/realtime · high confidence
New Realtime API resource with WebRTC calls and client secrets
The \src/openai/resources/realtime\ module has been added, exposing the Realtime API for low-latency, multi-modal conversations. This includes the \Realtime\ resource with a \connect()\ method for establishing WebSocket sessions, a \calls\ sub-resource for managing WebRTC calls (create, accept, hangup, refer, reject), and a \client\_secrets\ sub-resource for generating short-lived tokens to grant client-side access without exposing the main API key. The module also exports a comprehensive set of types for session configuration, audio handling, and event streams.
src/openai/resources/realtime · high confidence
New Realtime API type definitions and parameters
The \src/openai/types/realtime\ module now includes generated type definitions for the Realtime API, enabling users to interact with real-time audio conversations. This update introduces comprehensive parameter types for session configuration (including audio input/output settings, turn detection, and noise reduction), call management (accept, reject, refer), and conversation item manipulation (create, delete, retrieve, truncate). It also defines the full set of client and server events, such as audio buffer operations, response creation/cancellation, and MCP tool interactions, along with specific model support for \gpt-realtime\ variants and transcription models like \gpt-4o-transcribe-diarize\.
src/openai/types/realtime · high confidence
New Responses API resource with input items, token counting, and streaming support
The SDK now exposes a dedicated \responses\ resource under \src/openai/resources/responses\, providing \create\, \retrieve\, \delete\, \cancel\, and \compact\ methods for the OpenAI Responses API. This location also introduces \input\_items\ for paginating response inputs and \input\_tokens\ for estimating token usage before generation. The implementation supports both synchronous and asynchronous clients, includes raw and streaming response wrappers, and integrates with the new \httpx2\ HTTP client for underlying transport.
src/openai/resources/responses · high confidence
New Responses API type definitions and tooling support
The SDK now includes generated type definitions for the new Responses API, enabling users to interact with the updated model interface. This update introduces support for new tool types including computer use (with mouse and keyboard actions), file search, shell execution, and custom tools. It also adds parameters for container environments, network policies, and inline skills, along with new event types for streaming responses and compaction.
src/openai/types/responses · high confidence
New SDK examples for advanced features and providers
The examples directory now includes comprehensive demonstrations for new SDK capabilities: Amazon Bedrock provider support (bedrock.py, bedrock\_runtime.py), X.509 workload identity federation authentication (x509\_workload\_identity.py, x509\_workload\_identity\_async.py), and the new Responses API with WebSocket sessions (responses\_websocket.py) and input token counting (responses\_input\_tokens.py). Additional examples cover audio helpers (audio.py, speech\_to\_text.py, text\_to\_speech.py), image streaming with partial images (image\_stream.py), chunked file uploads (uploads.py), and HTTPX2 client integration (httpx2\_client.py, mtls\_httpx2.py, mtls\_httpx2\_async.py).
examples · high confidence
New SDK helper library for Azure, webhooks, and polling
The SDK now includes a new \src/openai/lib\ module providing helper utilities for common integration patterns. This includes \azure.py\ for managing Azure OpenAI authentication boundaries and endpoint routing, \\_webhooks.py\ for validating webhook signatures and preventing replay attacks, and \\_vector\_stores.py\ and \\_files.py\ for polling file and vector store processing states. Additionally, \\_websocket.py\ and \\_azure\_websocket.py\ enforce strict origin checks to prevent cross-origin WebSocket redirects, while \\_pydantic.py\ and \\_tools.py\ provide utilities for strict JSON schema generation and Pydantic function tools.
src/openai/lib · high confidence
New Safety Alerts API support
The SDK now includes a new Safety resource that allows you to retrieve project safety alerts. You can access this via \client.safety.alerts.retrieve(id)\ for synchronous calls or \client.safety.alerts.retrieve(id)\ for asynchronous calls, enabling you to monitor and manage safety-related notifications for your API project.
src/openai/resources/safety, src/openai/types/safety · high confidence
New X.509 workload identity authentication support
The library now supports authenticating via X.509 workload identity, allowing users to bind verified external identities to service accounts using client certificates configured on the HTTP transport. This feature introduces new types and providers in the \src/openai/auth\ module, including \X509WorkloadIdentity\, \x509\_workload\_identity\, and specific token providers for Kubernetes (\k8s\_service\_account\_token\_provider\), Azure Managed Identities (\azure\_managed\_identity\_token\_provider\), and GCP (\gcp\_id\_token\_provider\). The implementation relies on the \httpx2\ client library for handling token exchanges and request validation, ensuring secure communication with OpenAI's MTLS endpoints.
src/openai/auth · high confidence
New chat completion storage and retrieval API
The chat completions resource now includes a dedicated \messages\ sub-resource that allows you to retrieve the individual messages from a previously stored chat completion. By creating a completion with the \store\ parameter set to \true\, you can later use \client.chat.completions.messages.list(completion\_id)\ to fetch the conversation history, supporting pagination and sorting. This feature enables building applications that need to inspect or replay stored assistant interactions.
src/openai/resources/chat/completions · high confidence
New chat resource module with raw and streaming response support
The \src/openai/resources/chat\ package has been introduced, providing the \Chat\ and \AsyncChat\ resource classes along with their raw and streaming response variants (\ChatWithRawResponse\, \ChatWithStreamingResponse\, etc.). This module exposes the chat completions API, allowing users to access raw HTTP responses or stream responses directly via the \.with\_raw\_response\ and \.with\_streaming\_response\ prefixes on the chat resource.
src/openai/resources/chat · high confidence
New chunked upload API for large files
The client now includes a dedicated \uploads\ resource that enables uploading large files (up to 8 GB) in 64 MB chunks. This feature introduces \Uploads\ and \Parts\ classes with both synchronous and asynchronous support, allowing users to split files into parts and upload them sequentially or in parallel. The \upload\_file\_chunked\ helper method simplifies this process by automatically handling file splitting, part creation, and upload completion, supporting both file paths and in-memory byte data.
src/openai/resources/uploads · high confidence
New examples for structured outputs and Responses API background streaming
Added example scripts demonstrating structured output parsing with Pydantic models for both Chat Completions and the Responses API, including streaming and tool-calling scenarios. Also added examples for the Responses API's background streaming feature, showing how to interrupt and resume long-running async or sync streams.
openai · high confidence
New fine-tuning checkpoint permissions API
The SDK now exposes a new API for managing permissions on fine-tuning model checkpoints. Users can grant access to specific projects for a given checkpoint using the \create\ method, list existing permissions via the paginated \list\ method, and retrieve individual permissions. Note that the \retrieve\ method is deprecated in favor of the new list approach, and these operations require an admin API key.
_src/openai/resources/fine\tuning/checkpoints · high confidence
New fine-tuning jobs and checkpoints API resources
The SDK now exposes dedicated resources for managing fine-tuning jobs and their checkpoints under \src/openai/resources/fine\_tuning/jobs\. This adds \Jobs\ and \Checkpoints\ classes (with async and streaming/raw response variants) that allow users to create fine-tuning jobs, list and retrieve job details and events, and list checkpoints for a specific job. The implementation is generated from the OpenAPI spec and integrates with the existing client architecture, including support for pagination, custom headers/queries, and timeout overrides.
_src/openai/resources/fine\tuning/jobs · high confidence
New fine-tuning resource structure with raw and streaming response support
The fine-tuning resource module has been restructured to expose a comprehensive API surface for managing fine-tuning jobs, checkpoints, and alpha features. This change introduces dedicated resource classes for both synchronous and asynchronous usage, each providing access to sub-resources for jobs, checkpoints, and alpha endpoints. Additionally, the module now supports raw response access (returning the raw HTTP response object) and streaming response handling (avoiding eager body reads) for all fine-tuning operations, allowing users to inspect headers or process large responses more efficiently.
_src/openai/resources/fine\tuning · high confidence
New streaming helpers for Assistant API with robust delta accumulation
This change introduces a new \src/openai/lib/streaming\ module containing \AssistantEventHandler\ and \AssistantStreamManager\ classes to simplify consuming Assistant API streams. These handlers provide convenient iteration over stream events and expose aggregated data like final runs, messages, and run steps. The module also includes a new \\_deltas.py\ utility that implements logic to correctly accumulate streaming deltas, specifically handling indexed lists (such as tool calls) to prevent data loss or corruption when multiple fragments arrive for the same index.
src/openai/lib/streaming · high confidence
New streaming responses API with structured output support
This change introduces a new \src/openai/lib/streaming/responses\ module that provides \ResponseStream\ and \AsyncResponseStream\ classes for handling the new \/v1/responses\ API. These streams support structured output via a \text\_format\ parameter, allowing users to receive parsed responses directly. The module includes a comprehensive set of event types (e.g., \ResponseTextDeltaEvent\, \ResponseFunctionCallArgumentsDeltaEvent\) and handles various tool calls (MCP, Shell, Code Interpreter, Web Search, Image Gen) and compaction events. It also introduces a \starting\_after\ parameter to resume streams from a specific sequence number.
src/openai/lib/streaming/responses · high confidence
New structured streaming API for chat completions
A new streaming module has been introduced for chat completions, providing \ChatCompletionStream\ and \AsyncChatCompletionStream\ classes that wrap the raw API response to emit granular events (such as \content.done\, \refusal.done\, and tool call deltas) while accumulating a final \ParsedChatCompletion\ object. This addition supports automatic parsing of response content into specified types and handles tool call argument accumulation, making it easier to build applications that rely on structured outputs and real-time event processing.
src/openai/lib/streaming/chat · high confidence
New webhook endpoint management types and event definitions
The SDK now includes generated type definitions for managing webhook endpoints, allowing users to create, list, update, and test webhook configurations. This change introduces parameter types for creating and updating endpoints (including name, URL, and event subscriptions) and defines a comprehensive set of supported webhook event types, such as batch operations, response lifecycle events, evaluation runs, fine-tuning jobs, realtime calls, video processing, and safety alerts.
src/openai/types/webhooks · high confidence
SDK v2 introduces new API resources and migrates to httpx2
The \src/openai/resources\ package has been restructured to expose new API capabilities including Batches, Content Provenance Checks, Evals, Skills, Videos, and Uploads, alongside updated Chat, Completions, Embeddings, Files, and Images resources. This change also migrates the underlying HTTP client from httpx to httpx2 and introduces a \dimensions\ parameter for the Embeddings API to allow control over output vector size.
src/openai/resources · high confidence
Service account API key creation now supports expiration settings
The API for creating service account API keys has been updated to include an optional \expires\_in\_seconds\ parameter, allowing users to specify a custom expiration duration for new keys. This change is reflected in the generated \APIKeyCreateParams\ type, which now accepts this field alongside the existing \project\_id\, \name\, and \scopes\ fields.
_src/openai/types/admin/organization/projects/service\accounts · high confidence
Support for DPO and Reinforcement Fine-Tuning Methods
The fine-tuning API now supports Direct Preference Optimization (DPO) and Reinforcement learning methods alongside the existing supervised approach. Users can configure these new methods via the \method\ parameter in job creation, specifying \dpo\ with beta and learning rate hyperparameters, or \reinforcement\ with a required grader (such as string check, text similarity, or score model) and specific hyperparameters like compute multiplier and reasoning effort. The \method\ field replaces the deprecated \hyperparameters\ top-level field, and the API also exposes Weights & Biases integration for tracking job metrics.
_src/openai/types/fine\tuning · high confidence
Removals
Removal of client-side semantic search example
The client-side semantic search example script and its documentation have been removed from the repository. Users can no longer run the local Python implementation that formats documents into prompts to derive relevance scores via logprobs; this functionality was previously available as an alternative to the server-side search endpoint.
examples/semanticsearch · high confidence
Removal of legacy CLI entry point
The \bin/openai\ script, which previously served as the command-line interface for the OpenAI Python client, has been removed. This change eliminates the direct CLI entry point that allowed users to configure API keys, base URLs, and organizations via command-line arguments and execute API calls through the \api\ subcommand.
bin · high confidence
Removal of public PyPI placeholder package
The public setup.py and Makefile have been removed, eliminating the placeholder package that previously existed on the public PyPI instance. This change removes the mechanism that enforced the OPENAI\_UPLOAD environment variable check and the associated build/upload targets, indicating the package is no longer distributed or maintained via this public entry point.
public · high confidence
Architecture
Internal utility module restructuring and new helper implementations
The internal utility package has been reorganized into a modular structure with dedicated files for specific concerns, including type compatibility checks, datetime parsing, JSON serialization, logging with sensitive header redaction, URI path templating, lazy resource loading, and async/sync execution helpers. This change introduces new capabilities such as a \SensitiveHeadersFilter\ for logging, RFC-compliant path template interpolation, and improved type inspection utilities, while exposing these helpers through a consolidated \\_\init\\_.py\ for internal use.
_src/openai/\utils · high confidence
Behavioural changes
Chat API types regenerated with new tool, audio, and caching capabilities
The \src/openai/types/chat\ module has been regenerated from the OpenAPI spec, introducing support for custom tools (via \ChatCompletionCustomToolParam\ and \ChatCompletionMessageCustomToolCallParam\), audio output parameters (\ChatCompletionAudioParam\), and prompt caching breakpoints (\PromptCacheBreakpoint\). The message role system now includes a \developer\ role (\ChatCompletionDeveloperMessageParam\) alongside the existing \system\ role, and tool choice options have been expanded to include \allowed\_tools\ constraints (\ChatCompletionAllowedToolChoiceParam\). Streaming responses now support usage reporting and obfuscation options (\ChatCompletionStreamOptionsParam\), and the \ChatCompletionMessageParam\ union has been updated to reflect these new message types and tool call structures.
src/openai/types/chat · high confidence
Deprecation of Assistants API in favor of Responses API
The Assistants API resources in \src/openai/resources/beta/threads/runs\ are now marked as deprecated, signaling that users should migrate to the Responses API. The generated code for \Runs\ and \Steps\ (including their async variants and streaming/raw response wrappers) retains full functionality but includes deprecation warnings on key methods like \create\ and \retrieve\. This change reflects the platform's shift away from the beta Assistants API toward the newer Responses API, while maintaining backward compatibility for existing integrations.
src/openai/resources/beta/threads/runs · high confidence
Deprecation warning added to Assistants API methods
Methods in the Threads, Messages, and Runs resources now emit a deprecation warning indicating that the Assistants API is deprecated in favor of the Responses API. This change alerts users that these beta features are being phased out and encourages migration to the newer API surface.
src/openai/resources/beta/threads · high confidence
Expanded organization admin type definitions
The organization admin module now exposes a comprehensive set of generated type definitions for managing organization resources, including projects, groups, roles, invites, certificates, and admin API keys. This update adds support for configuring project residency and data retention, managing spend limits and alerts, and filtering audit logs by a wide range of event types. It also introduces granular project-level controls for model permissions, hosted tool permissions (code interpreter, file search, image generation, MCP, web search), and rate limits, along with updated parameters for service account creation with expiration controls.
src/openai/types/admin/organization · high confidence
Introduce custom-code budget and repository governance for generated SDK
This release establishes a formal governance framework for the generated OpenAI Python SDK. A new custom-code budget is enforced via \.castiron-ratchet.json\, limiting handwritten patches to 10,000 lines and requiring human approval for any increases. Repository guidance is codified in \AGENTS.md\ and \CONTRIBUTING.md\, detailing security requirements for coding agents, dependency update policies, and Python version support rules. The minimum supported Python version is raised to 3.10, with \.python-version\ and \PYTHON\_VERSION\_POLICY.md\ reflecting this change. Additionally, the repository now includes \SECURITY.md\ for coordinated vulnerability disclosure and \api.md\ as a centralized API reference.
(repo-wide) · high confidence
Lazy-loading for optional audio and data dependencies
The library now uses lazy proxies for optional dependencies like numpy, pandas, and sounddevice. This means these packages are no longer required at import time; they are only loaded when actually used. If a user attempts to use a feature requiring one of these libraries without having it installed, they will receive a clear error message instructing them to install the specific extra (e.g., \openai\[voice\_helpers\]\ or \openai\[datalib\]\). This improves installation speed and reduces overhead for users who do not need audio or data processing features.
_src/openai/\extras · high confidence
Migrate development tooling to uv and Steady
The repository's development workflow has been updated to use the uv package manager for Python dependency resolution and the Steady mock server for API testing. The new bootstrap script installs Python dependencies via uv and enforces a specific pnpm version for Node tooling, while the test and mock scripts now rely on Steady instead of the previous Prism mock server. This change also introduces new scripts for enforcing Python version policies, detecting breaking changes via static analysis, and checking dependency security, replacing the older bootstrap and linting infrastructure.
scripts · high confidence
Migrated to a forked Steady tool with pinned Deno runtime
The development environment now uses a self-contained, pinned version of the Steady tooling sourced from a forked repository (openai-oss-forks/steady) rather than the upstream. This change introduces a new installation workflow under scripts/steady that downloads and verifies a specific Deno runtime (v2.7.11) alongside the Steady source code, ensuring reproducible builds through strict SHA-256 checksums for both the runtime and the source. The system includes integrity verification to prevent execution of modified or cached Git hooks, and provides scripts to update the pinned revision and verify the installation locally.
scripts/steady · high confidence
SDK rewritten for httpx2 with new client architecture and data residency support
The OpenAI Python SDK has been completely rewritten to use the httpx2 HTTP library instead of the legacy httpx, introducing new default connection limits (1000 max connections, 100 keep-alive) and a 10-minute default timeout. The client now supports named data residency endpoints (global, us, eu, ae) via a dedicated parameter, and provides new default HTTP client classes (DefaultHttpx2Client, DefaultAsyncHttpx2Client) alongside legacy httpx compatibility layers. The module-level client API has been restructured with explicit configuration variables for api\_key, admin\_api\_key, organization, project, and other settings, while maintaining backward compatibility through lazy resource loading and proxy classes.
src/openai · high confidence
SDK types regenerated with new API capabilities
The type definitions in src/openai/types have been regenerated from the OpenAPI specification, introducing support for several new API features. Users can now utilize the Evals API for model evaluation, create and manage Containers with network policies and skills, and process video content via new video endpoints. The Batch API has been updated to support additional endpoints including /v1/videos and /v1/responses, and includes new expiration controls for output files. Audio capabilities have expanded with new models like gpt-4o-transcribe-diarize and response formats such as diarized\_json. Image generation types now reflect support for GPT Image models with features like background transparency and input fidelity controls. Additionally, file handling includes a new 'evals' purpose and chunking strategies, while embedding models support dimension reduction and base64 encoding.
src/openai/types · high confidence
Updated audio type definitions for new models and diarization support
The audio type definitions have been refreshed to reflect the latest API capabilities. For text-to-speech, the \SpeechModel\ type now includes \gpt-4o-mini-tts\ variants, and \SpeechCreateParams\ supports new voices (marin, cedar), custom voice IDs, and additional response formats (aac, flac). For speech-to-text, the \AudioModel\ type adds \gpt-transcribe\, \gpt-4o-transcribe\, \gpt-4o-mini-transcribe\, and the new \gpt-4o-transcribe-diarize\ model. Transcription parameters now support chunking strategies (auto/server\_vad), logprobs inclusion, and speaker diarization fields (known\_speaker\_names/references). The transcription response type now includes \TranscriptionDiarized\, and streaming events are explicitly typed for segment, delta, and done events.
src/openai/types/audio · high confidence
Updated model identifiers and filter types in shared parameters
The shared parameters module has been updated to include new model identifiers for the GPT-5 and GPT-6 families (such as gpt-6-astra, gpt-5.5, and gpt-5.1-codex-max) and the o3/o4-mini deep-research models. Additionally, the ComparisonFilter type now supports 'in' and 'nin' operators, and the ResponsesModel type has been expanded to include new o1-pro, o3-pro, and computer-use-preview model slugs.
_src/openai/types/shared\params · high confidence
Updated shared type definitions with new model identifiers and Responses API support
The shared types module has been regenerated to include new model identifiers for the GPT-5 and GPT-6 families (such as gpt-6-astra, gpt-5.5-pro, and gpt-5.1-codex-max) alongside existing o-series models. It also introduces a dedicated ResponsesModel type alias that supports the new Responses API, while updating the ChatModel type to reflect the latest available chat models. Additionally, the module now exports updated type definitions for function parameters, reasoning effort levels, and response formats.
src/openai/types/shared · high confidence
Vector Stores API resources now use httpx2 and updated type signatures
The Vector Stores resource files (vector\_stores, files, and file\_batches) have been regenerated to use the httpx2 HTTP client library instead of the previous version, and parameter types have been updated to use SequenceNotStr and Omit for better type safety. This change ensures that vector store operations align with the broader client migration to httpx2 and provides stricter typing for file and batch inputs.
_src/openai/resources/vector\stores · high confidence
Test coverage
Added comprehensive test coverage for SDK utility functions; Added comprehensive test coverage for the Responses API; Added comprehensive test suite for chat completions and streaming; Added generated tests for Beta Agents API resources; Added generated tests for Vector Store files and file batches; Added generated tests for chat completions and stored messages; Added generated tests for new beta API resources; Added test for ChatCompletionToolParam instantiation; Added tests for Realtime API calls and client secrets; Added tests for Responses API input items and input tokens; Added tests for alpha fine-tuning grader API; Added tests for beta API resources; Added tests for beta threads, messages, runs, and run steps; Added tests for conversations items API; Added tests for fine-tuning checkpoint permissions; Added tests for fine-tuning jobs and checkpoints; Added tests for new Admin API organization resources; Added tests for the Live API and transcript grouping logic; Added tests for webhook event type listing; Expanded test coverage for Azure authentication, Bedrock live integration, and audio response formats; New validation scripts for SDK build artifacts and tooling; Updated test snapshots for structured outputs and refusal handling.
Dependencies
OpenAI Python SDK 3.16.0 release with HTTPX2 migration and Python 3.14 support
This release updates the SDK to version 3.16.0, introducing a migration to the HTTPX2 client library (httpx2\>=2.7.0) for networking and adding support for Python 3.14. The package now requires Python 3.10 or higher and updates core dependencies including pydantic (\>=1.10.13, \<3), typing-extensions (\>=4.14, \<5), anyio (\>=4.10.0, \<5), and jiter (\>=0.16.0, \<1). Optional dependencies have been adjusted, such as aiohttp (\>=3.14.3) and websockets (\>=13, \<16), and the build system has migrated to uv with hatchling==1.27.0. Development tooling includes mypy 2.3.1, pytest 9.0.3, and ruff, with pyright 1.1.413 added for type checking.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 67.
Lenses
- Code Health 60
- Architecture 100
- Maturity 65
- Readiness 75
- Security 83
Changes since last survey
- 300 commits — 236 feature/other, 64 fixes
By area
- (root) — 121 commits
- src/openai — 121 commits
- .github/workflows — 22 commits
- (repo) — 10 commits
- tests/api_resources — 5 commits
- scripts/castiron — 4 commits
- examples/realtime — 3 commits
- examples/async_demo.py — 2 commits
- scripts/mock — 2 commits
- scripts/steady — 2 commits
- tests/lib — 2 commits
- examples/azure.py — 1 commit
- examples/generate_file.sh — 1 commit
- examples/module_client.py — 1 commit
- scripts/bootstrap — 1 commit
- scripts/utils — 1 commit
- tests/fixtures — 1 commit
Notable commits
- fix: Fix Bedrock with_options overrides
- fix: Fix streaming delta merge for duplicate tool call indexes (#3425)
- fix: Revert "chore: check release PR custom code sync"
- fix: build: fix release workflow permissions (#3389)
- fix: ci: fix CodeQL permissions for private repositories (#3606)
- fix: fix(api): accept incomplete web search call statuses (#3786)
- fix: fix(api): allow setting bedrock api keys on the client directly
- fix: fix(api): clarify audio upload metadata requirements (#3596)
- fix: fix(api): correct prompt_cache_retention enum value from in-memory to in_memory
- fix: fix(api): encode Realtime call offers and session configuration (#3736)
- fix: fix(api): fix imagegen size enum regression
- fix: fix(api): preserve python api key attribute type
- fix: fix(api): resolve python auth type checks
- fix: fix(api): support admin api key auth
- fix: fix(audio): restore transcription keyword overload
- fix: fix(auth): harden X.509 workload identity integration (#3740)
- fix: fix(auth): prioritize first auth header
- fix: fix(azure): encode deployment names consistently (#3683)
- fix: fix(azure): keep provider validation errors value-free (#3691)
- fix: fix(azure): preserve deployment routing across copy/with_options (#3593)
- …and 280 more
Architecture
- 0 containers · 1 bounded contexts · 0 dependency edges (baseline)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
openai/openai-python was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 18 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit dcbd6b8f5c26bc09899a584158729b5b67ba7dc6 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-5d04157a340d.