[project] name = "openai" version = "3.62.2" description = "The official Python library for the openai API" dynamic = ["readme"] license = "Apache-2.0" authors = [ { name = "OpenAI", email = "support@openai.com" }, ] dependencies = [ "httpx2>=2.12.0, <3", "pydantic>=1.10.13, <3, !=2.0.*, !=2.1.*, !=2.2.*, !=2.3.*", "typing-extensions>=4.14, <5", "anyio>=4.10.0, <5", "sniffio", "jiter>=0.16.0, <1", ] requires-python = ">= 3.10" classifiers = [ "Typing :: Typed", "Intended Audience :: Developers", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: MacOS", "Operating System :: POSIX :: Linux", "Operating System :: Microsoft :: Windows", "Topic :: Software Development :: Libraries :: Python Modules", "License :: OSI Approved :: Apache Software License" ] [project.urls] Homepage = "https://github.com/openai/openai-python" Repository = "https://github.com/openai/openai-python" [project.optional-dependencies] aiohttp = [ "aiohttp>=3.14.4", "multidict>=6.9.1", "yarl>=1.25.1", ] realtime = ["websockets>=13,<18"] datalib = ["numpy >= 1", "pandas >= 1.2.3"] voice_helpers = ["sounddevice>=0.5.1", "numpy>=2.0.2"] bedrock = [ "botocore>=1.40.0,<2", "urllib3>=2.7.0,<3", ] vertex = ["google-auth[requests]>=2.36,<3"] [dependency-groups] dev = [ "ty==1.0.0", "pytest>=9.0.3", "pytest-asyncio>=1.4.0", "Pillow==12.3.0", "ruff", "rich>=13.7.1", "inline-snapshot>=0.28.0", "azure-identity >=1.14.1", "botocore==1.44.9", "pandas-stubs >= 1.1.0.11", "trio >=0.22.2", "pytest-xdist>=3.6.1", "griffe>=1", "types-requests>=2.33.0.20261006", ] pydantic-v1 = ["pydantic>=1.10.26,<2"] pydantic-v2 = ["pydantic>=2,<3"] provider-computer = ["Pillow==12.3.0"] provider-browser = ["playwright==1.65.2"] browser-demo = ["playwright==1.65.2"] # Isolated build requirements are exported with hashes by scripts/build. build = [ "hatchling==1.33.0", "packaging==26.3", "pathspec==1.1.1", "pluggy==1.7.0", "tomli==2.4.1; python_version < '3.11'", "trove-classifiers==2026.9.21.13", ] [tool.uv] # Keep the minimum compatible with Dependabot's uv updater; CI pins its version. required-version = ">=0.12.1" exclude-newer = "8 days" # Explicit ty 1.0 adoption; remove after 2026-12-09 once the eight-day cooldown clears. exclude-newer-package = { ty = "2026-12-01T16:47:32Z" } default-groups = ["dev", "pydantic-v2"] conflicts = [ [{ group = "pydantic-v1" }, { group = "pydantic-v2" }], ] # Security floors for transitive dependencies. Constraints do not # install these packages into the SDK's runtime environment. constraint-dependencies = [ # HTTPX2 also publishes an exact pin to its matching httpcore2 release. "httpcore2>=2.12.0", "azure-core>=1.38.0", "certifi>=2026.10.18", "cryptography>=50.0.0", "msal>=1.37.0", "pyasn1>=0.6.5", "pygments>=2.20.0", "pyjwt>=2.15.0", "requests>=2.33.0", ] # Also constrain editable/source builds performed by uv sync. build-constraint-dependencies = [ "hatchling==1.33.0", "packaging==26.3", "pathspec==1.1.1", "pluggy==1.7.0", "tomli==2.4.1; python_version < '3.11'", "trove-classifiers==2026.9.21.13", ] [build-system] requires = ["hatchling==1.33.0"] build-backend = "hatchling.build" [tool.hatch.build] include = [ "src/*" ] [tool.hatch.build.targets.wheel] packages = ["src/openai"] [tool.hatch.build.targets.sdist] # Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc) include = [ "/*.toml", "/*.json", "/*.lock", "/*.md", "/.node-version", "/pnpm-lock.yaml", "/pnpm-workspace.yaml", "bin/*", "examples/*", "scripts/*", "src/*", "tests/*", ] [tool.hatch.metadata.hooks.custom] path = "scripts/hatch_metadata.py" [tool.pytest.ini_options] testpaths = ["tests"] addopts = "--tb=short -n auto --durations=20" xfail_strict = true asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "session" filterwarnings = [ "error" ] [tool.inline-snapshot] format-command="ruff format --stdin-filename {filename}" # Repository checks use ty; published annotations remain checker-independent. [tool.ty.environment] python-version = "3.10" [tool.ty.src] exclude = [ "examples/browser/", "examples/browser-use-demo/", "examples/computer-desktop/", "_dev", "node_modules", ".pnpm-store", ".venv", ".venv-pydantic-v1", ".nox", "tests/respx2", "src/openai/_vendor", "scripts/hatch_metadata.py", "examples/realtime/audio_util.py", "examples/realtime/push_to_talk_app.py", ] [tool.ty.rules] unused-type-ignore-comment = "error" unused-ignore-comment = "error" redundant-cast = "error" [[tool.ty.overrides]] include = ["tests/test_lazy_imports.py"] [tool.ty.overrides.rules] # Reexports retain callable/class subtypes that assert_type cannot spell exactly. assert-type-unspellable-subtype = "ignore" [[tool.ty.overrides]] include = [ "src/openai/_exceptions.py", "src/openai/lib/streaming/responses/_events.py", "src/openai/types/chat/parsed_chat_completion.py", "src/openai/types/chat/parsed_function_tool_call.py", "src/openai/types/evals/runs/output_item_list_response.py", "src/openai/types/evals/runs/output_item_retrieve_response.py", "tests/test_models.py", ] [tool.ty.overrides.rules] # These Pydantic models and HTTP exceptions intentionally narrow mutable fields. # Preserve their existing contract without suppressing unrelated overrides. incompatible-mutable-override = "ignore" [[tool.ty.overrides]] include = [ "tests/**", "src/openai/resources/**", "src/openai/lib/_assistants_*.py", ] [tool.ty.overrides.rules] # Tests exercise deprecated entrypoints; their implementations and reexports must remain available. deprecated = "ignore" [tool.ruff] extend-exclude = ["tests/respx2", "src/openai/_vendor"] line-length = 120 output-format = "grouped" target-version = "py310" [tool.ruff.format] docstring-code-format = true [tool.ruff.lint] select = [ # isort "I", # bugbear rules "B", # remove unused imports "F401", # check for missing future annotations "FA102", # bare except statements "E722", # unused arguments "ARG", # print statements "T201", "T203", # misuse of typing.TYPE_CHECKING "TC004", # import rules "TID251", ] ignore = [ # mutable defaults "B006", ] unfixable = [ # disable auto fix for print statements "T201", "T203", ] extend-safe-fixes = ["FA102"] [tool.ruff.lint.flake8-tidy-imports.banned-api] "functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" [tool.ruff.lint.isort] length-sort = true length-sort-straight = true combine-as-imports = true extra-standard-library = ["typing_extensions"] known-first-party = ["openai", "tests"] [tool.ruff.lint.per-file-ignores] "bin/**.py" = ["T201", "T203"] "scripts/**.py" = ["T201", "T203"] "tests/**.py" = ["T201", "T203"] "examples/**.py" = ["T201", "T203"]