openai
The official Python library for the openai API
Decision gist · record as of 2026-08-14
Yes. This is the official OpenAI Python client, actively maintained, with zero known vulnerabilities, low install friction, and permissive licensing. Install it if you need to call OpenAI's API from Python—it's the standard and recommended choice for this use case.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; an OpenAI API key must be provided via environment variable or constructor argument.
- Low friction install with a pure-Python wheel and 8 runtime dependencies.
- Actively maintained with a recent release and high repository activity.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
last release 2026-08-12 (2 days) · last repo commit 2026-08-13 · 31,361 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 398,217,507 downloads/mo, #107 on PyPI
Alternatives
Verify before relying
pip install openai
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
response = client.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)- Whether workload identity authentication (Kubernetes, Azure, GCP) is production-ready or still experimental.
- Performance characteristics and rate-limit handling behavior under high concurrency.
- Whether the Responses API (gpt-5.5 examples) is stable or still in preview.
What it is and what it does
The openai package is the official Python client for OpenAI's REST API, generated from OpenAI's OpenAPI specification using Stainless. It provides both synchronous and asynchronous clients powered by HTTPX2, with full type hints for all request parameters and response fields. The library supports Python 3.10 and later and includes convenience methods for the Chat Completions API, Responses API, vision features, and streaming responses via Server-Sent Events.
Developers use it to integrate OpenAI models (like GPT) into Python applications. The library handles authentication via API keys or workload identity (Kubernetes, Azure, GCP), manages HTTP connections, and abstracts away REST details. It's actively maintained, has no known vulnerabilities, and is widely used in production—making it the standard choice for Python developers building on OpenAI's platform.
Use it for
- Build a chatbot or conversational AI by calling client.chat.completions.create() with user messages.
- Process images with vision capabilities by passing image URLs or base64-encoded data to the Responses API.
- Stream real-time responses from language models using Server-Sent Events for interactive applications.
- Authenticate securely in cloud environments (Kubernetes, Azure, GCP) using workload identity instead of long-lived API keys.
- Integrate OpenAI models into async Python applications with AsyncOpenAI for non-blocking I/O.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is the official OpenAI Python client, actively maintained, with zero known vulnerabilities, low install friction, and permissive licensing. Install it if you need to call OpenAI's API from Python—it's the standard and recommended choice for this use case.
Install
openai on PyPI
Before you install
Low friction install with a pure-Python wheel and 8 runtime dependencies. Actively maintained with a recent release and high repository activity.
Requires Python 3.10 or later; an OpenAI API key must be provided via environment variable or constructor argument.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install openai
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
response = client.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
Verify before relying
- Whether workload identity authentication (Kubernetes, Azure, GCP) is production-ready or still experimental.
- Performance characteristics and rate-limit handling behavior under high concurrency.
- Whether the Responses API (gpt-5.5 examples) is stable or still in preview.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 8 packagesanyiodistrohttpx2jiterpydanticsniffiotqdmtyping-extensions |
| Maintenance | Actively maintained 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 398,217,507 / month, #107 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: openai-3.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “openai api client python”
- openaiProvides a Python client library for the OpenAI REST API, with…
- agent-framework-openaiProvides OpenAI and Azure OpenAI integration for Microsoft Agent…
- oci-openaiProvides OpenAI-compatible Python clients for accessing OCI…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also groq · python-freeipa · together · perplexityai · portkey-ai · composio-openai · writer-sdk · llama-stack-client · oci-openai · llama-api-client