Python 88.3%
TypeScript 7.6%
Shell 4.1%
1[project]2name = "openai"3version = "3.16.2"4description = "The official Python library for the openai API"5dynamic = ["readme"]6license = "Apache-2.0"7authors = [8{ name = "OpenAI", email = "support@openai.com" },9]1011dependencies = [12 "httpx2>=2.7.0, <3",13 "pydantic>=1.10.13, <3, !=2.0.*, !=2.1.*, !=2.2.*, !=2.3.*",14 "typing-extensions>=4.14, <5",15 "anyio>=4.10.0, <5",16 "sniffio",17 "jiter>=0.16.0, <1",18]1920requires-python = ">= 3.10"21classifiers = [22 "Typing :: Typed",23 "Intended Audience :: Developers",24 "Programming Language :: Python :: 3.10",25 "Programming Language :: Python :: 3.11",26 "Programming Language :: Python :: 3.12",27 "Programming Language :: Python :: 3.13",28 "Programming Language :: Python :: 3.14",29 "Operating System :: OS Independent",30 "Operating System :: POSIX",31 "Operating System :: MacOS",32 "Operating System :: POSIX :: Linux",33 "Operating System :: Microsoft :: Windows",34 "Topic :: Software Development :: Libraries :: Python Modules",35 "License :: OSI Approved :: Apache Software License"36]3738[project.urls]39Homepage = "https://github.com/openai/openai-python"40Repository = "https://github.com/openai/openai-python"4142[project.optional-dependencies]43aiohttp = [44 "aiohttp>=3.14.3",45]46realtime = ["websockets >= 13, < 16"]47datalib = ["numpy >= 1", "pandas >= 1.2.3"]48voice_helpers = ["sounddevice>=0.5.1", "numpy>=2.0.2"]49bedrock = [50 "botocore>=1.40.0,<2",51 "urllib3>=2.7.0,<3",52]5354[dependency-groups]55dev = [56 "mypy==2.3.1",57 "pytest>=9.0.3",58 "pytest-asyncio>=1.4.0",59 "ruff",60 "rich>=13.7.1",61 "inline-snapshot>=0.28.0",62 "azure-identity >=1.14.1",63 "botocore==1.42.97",64 "pandas-stubs >= 1.1.0.11",65 "trio >=0.22.2",66 "pytest-xdist>=3.6.1",67 "griffe>=1",68]69pydantic-v1 = ["pydantic>=1.10.26,<2"]70pydantic-v2 = ["pydantic>=2,<3"]71# Isolated build requirements are exported with hashes by scripts/build.72build = [73 "hatchling==1.27.0",74 "packaging==26.3",75 "pathspec==1.1.1",76 "pluggy==1.6.0",77 "tomli==2.4.1; python_version < '3.11'",78 "trove-classifiers==2026.6.1.19",79]8081[tool.uv]82# Keep the minimum compatible with Dependabot's uv updater; CI pins its version.83required-version = ">=0.12.1"84exclude-newer = "8 days"85default-groups = ["dev", "pydantic-v2"]86conflicts = [[{ group = "pydantic-v1" }, { group = "pydantic-v2" }]]87# Security floors for transitive development dependencies. Constraints do not88# install these packages into the SDK's runtime environment.89constraint-dependencies = [90 "azure-core>=1.38.0",91 "cryptography>=50.0.0",92 "msal>=1.37.0",93 "pygments>=2.20.0",94 "pyjwt>=2.13.0",95 "requests>=2.33.0",96]97# Also constrain editable/source builds performed by uv sync.98build-constraint-dependencies = [99 "hatchling==1.27.0",100 "packaging==26.3",101 "pathspec==1.1.1",102 "pluggy==1.6.0",103 "tomli==2.4.1; python_version < '3.11'",104 "trove-classifiers==2026.6.1.19",105]106107108[build-system]109requires = ["hatchling==1.27.0"]110build-backend = "hatchling.build"111112[tool.hatch.build]113include = [114 "src/*"115]116117[tool.hatch.build.targets.wheel]118packages = ["src/openai"]119120[tool.hatch.build.targets.sdist]121# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc)122include = [123 "/*.toml",124 "/*.json",125 "/*.lock",126 "/*.md",127 "/.node-version",128 "/pnpm-lock.yaml",129 "/pnpm-workspace.yaml",130 "/mypy.ini",131 "bin/*",132 "examples/*",133 "scripts/*",134 "src/*",135 "tests/*",136]137138[tool.hatch.metadata.hooks.custom]139path = "scripts/hatch_metadata.py"140141[tool.pytest.ini_options]142testpaths = ["tests"]143addopts = "--tb=short -n auto --durations=20"144xfail_strict = true145asyncio_mode = "auto"146asyncio_default_fixture_loop_scope = "session"147filterwarnings = [148 "error"149]150151[tool.inline-snapshot]152format-command="ruff format --stdin-filename {filename}"153154[tool.pyright]155# this enables practically every flag given by pyright.156# there are a couple of flags that are still disabled by157# default in strict mode as they are experimental and niche.158typeCheckingMode = "strict"159pythonVersion = "3.10"160161exclude = [162 "_dev",163 "node_modules",164 ".pnpm-store",165 ".venv",166 ".venv-pydantic-v1",167 # Contributors may still have an environment from before the uv migration.168 ".nox",169 ".git",170 "tests/respx2",171 "src/openai/_vendor",172 # Loaded in Hatchling's isolated build environment.173 "scripts/hatch_metadata.py",174175 # uses inline `uv` script dependencies176 # which means it can't be type checked177 "examples/realtime/audio_util.py",178 "examples/realtime/push_to_talk_app.py"179]180181reportImplicitOverride = true182reportOverlappingOverload = false183184reportImportCycles = false185reportPrivateUsage = false186187[tool.mypy]188pretty = true189show_error_codes = true190191# Exclude _files.py because mypy isn't smart enough to apply192# the correct type narrowing and as this is an internal module193# it's fine to just use Pyright.194#195# We also exclude our `tests` as mypy doesn't always infer196# types correctly and Pyright will still catch any type errors.197#198# realtime examples use inline `uv` script dependencies199# which means it can't be type checked200exclude = [201 'src/openai/_files.py',202 'node_modules/.*',203 '\.pnpm-store/.*',204 'src/openai/_vendor/.*',205 'scripts/hatch_metadata.py',206 '_dev/.*.py',207 'tests/.*',208 'src/openai/_utils/_logs.py',209 'examples/realtime/audio_util.py',210 'examples/realtime/push_to_talk_app.py',211]212213strict_equality = true214implicit_reexport = true215check_untyped_defs = true216no_implicit_optional = true217218warn_return_any = true219warn_unreachable = true220warn_unused_configs = true221222# Turn these options off as it could cause conflicts223# with the Pyright options.224warn_unused_ignores = false225warn_redundant_casts = false226227disallow_any_generics = true228disallow_untyped_defs = true229disallow_untyped_calls = true230disallow_subclassing_any = true231disallow_incomplete_defs = true232disallow_untyped_decorators = true233cache_fine_grained = true234235# By default, mypy reports an error if you assign a value to the result236# of a function call that doesn't return anything. We do this in our test237# cases:238# ```239# result = ...240# assert result is None241# ```242# Changing this codegen to make mypy happy would increase complexity243# and would not be worth it.244disable_error_code = "func-returns-value,overload-cannot-match"245246# https://github.com/python/mypy/issues/12162247[[tool.mypy.overrides]]248module = "black.files.*"249ignore_errors = true250ignore_missing_imports = true251252# Preserve the existing _files.py exclusion when mypy follows its imports.253[[tool.mypy.overrides]]254module = "openai._files"255follow_imports = "silent"256257[tool.ruff]258extend-exclude = ["tests/respx2", "src/openai/_vendor"]259line-length = 120260output-format = "grouped"261target-version = "py310"262263[tool.ruff.format]264docstring-code-format = true265266[tool.ruff.lint]267select = [268 # isort269 "I",270 # bugbear rules271 "B",272 # remove unused imports273 "F401",274 # check for missing future annotations275 "FA102",276 # bare except statements277 "E722",278 # unused arguments279 "ARG",280 # print statements281 "T201",282 "T203",283 # misuse of typing.TYPE_CHECKING284 "TC004",285 # import rules286 "TID251",287]288ignore = [289 # mutable defaults290 "B006",291]292unfixable = [293 # disable auto fix for print statements294 "T201",295 "T203",296]297298extend-safe-fixes = ["FA102"]299300[tool.ruff.lint.flake8-tidy-imports.banned-api]301"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"302303[tool.ruff.lint.isort]304length-sort = true305length-sort-straight = true306combine-as-imports = true307extra-standard-library = ["typing_extensions"]308known-first-party = ["openai", "tests"]309310[tool.ruff.lint.per-file-ignores]311"bin/**.py" = ["T201", "T203"]312"scripts/**.py" = ["T201", "T203"]313"tests/**.py" = ["T201", "T203"]314"examples/**.py" = ["T201", "T203"]315