// the find
openai/openai-python
The official Python library for the OpenAI API
The official OpenAI Python client, auto-generated from their OpenAPI spec via Stainless. Covers the full API surface: Chat Completions, Responses, Realtime, embeddings, fine-tuning, audio, images, and a pile of admin/org endpoints. If you're calling OpenAI from Python, this is what you use.
Full sync/async parity via httpx with an optional aiohttp backend for high-concurrency scenarios. Workload identity support (K8s service account tokens, Azure managed identity, GCP) means you can stop rotating long-lived API keys in production. Auto-paginating iterators on list endpoints so you don't manually cursor through pages. Built-in retry logic with exponential backoff for 429s and 5xx errors, configurable per-client or per-request.
Being Stainless-generated means the internal code is not something you'd want to read or contribute to — it's machinery, not craft, and PRs from the community are effectively pointless since the generator owns the output. The `_request_id` naming convention (private-looking prefix on a public field) is a wart that they acknowledge but haven't fixed. The Realtime API swallows errors silently by design — error events come through the stream and nothing is raised, so you will miss failures if you don't explicitly listen for the error event type. The `with_raw_response` API returns a `LegacyAPIResponse` that they've already flagged for breaking changes in the next major version, so any code using it today is knowingly writing migration debt.