
OpenAI Python SDK
The official Python client for the OpenAI API.
About
The official OpenAI Python SDK (pip install openai): the canonical client for the Chat Completions, Responses, Assistants, Images, Audio, Embeddings, and Batch APIs, with typed models, streaming, retries, and async support. If you call OpenAI from Python, this is almost certainly what you use — 295.9M PyPI downloads/month makes it one of the most-installed Python packages in existence. 31.8k stars, Apache-2.0. It's a thin, faithful client (new API features land here first), not a framework — pair it with LiteLLM or a gateway for multi-provider work.
What it can do
- **Full API coverage**: chat, responses, images, audio, embeddings, files, batches
- **Typed + streaming**: pydantic-typed models, sync and async clients
- **Retries/timeouts**: built-in resilience primitives
- **First to update**: new OpenAI features ship here before third-party SDKs
Setup
```bash
pip install openai
export OPENAI_API_KEY="sk-..."
```
```python
from openai import OpenAI
client = OpenAI()
resp = client.chat.completions.create(model="gpt-4o-mini", messages=[{"role": "user", "content": "Hi"}])
print(resp.choices[0].message.content)
```
Docs: platform.openai.com/docs.
Prerequisites
Python 3.8+. An OpenAI API key.
Use cases
Works with
Trust score — 9/10
Scored 9/10 (verified tier, metrics-v1). Evidence: 31,830 GitHub stars (log-scaled vs catalog peers); blended with ~295,856,631 monthly package downloads; last push 0d ago; 96 releases/12mo; 137 open issues. Manual review: official SDK, new features land here first; 31.8k stars, 295.9M PyPI/mo; thin client by design, OpenAI(-compatible) only. License: Apache-2.0.
★ 31,830 GitHub stars
How the trust score is built
Full methodology →- Adoption · stars/downloads, log-scaled vs peers
- 8.9/10
- Maintenance · recency, releases, issue load
- 9.8/10
- Openness · license + docs
- 10.0/10
- Manual review · sanity read + red-flag check
- 9.0/10
- · 31,830 GitHub stars (log-scaled vs catalog peers)
- · blended with ~295,856,631 monthly package downloads
- · last push 0d ago; 96 releases/12mo; 137 open issues
- · manual review: official SDK, new features land here first; 31.8k stars, 295.9M PyPI/mo; thin client by design, OpenAI(-compatible) only
Sources
Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.