skillfed

openapi-python-client

Generate modern Python clients from OpenAPI

openapi-python-client v0.29.0 3.5M downloads/30d#2,617 on PyPI1,980
Permissive license MIT Active released

What it is and what it does

openapi-python-client is a code generator that reads OpenAPI 3.0 and 3.1 specifications and produces a complete, modern Python HTTP client library. It uses Jinja2 templates and outputs type-annotated models, endpoint functions organized by tag, and both plain and authenticated client classes. The generated code includes a pyproject.toml, README, and optional post-generation hooks (via ruff) for formatting and linting.

The tool is designed for Python developers who want to avoid hand-writing boilerplate HTTP client code. It depends on attrs, httpx, pydantic, ruamel-yaml, jinja2, typer, colorama, shellingham, and ruff. The project is actively maintained but explicitly notes it is still in development and does not support all OpenAPI features; it also does not support OpenAPI 2.x (Swagger).

Use it for:

  • Generate a typed Python client library from a published OpenAPI spec to avoid manual HTTP boilerplate and ensure type safety.
  • Automate client updates when an API's OpenAPI spec changes, regenerating models and endpoint functions without hand-editing.
  • Create multiple client libraries from different OpenAPI documents using custom Jinja2 templates to match your project's code style.
  • Integrate client generation into a CI/CD pipeline to keep generated clients in sync with API specifications.
  • Override model class names and customize generated code structure via YAML configuration for non-standard API schemas.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates type-annotated Python HTTP clients from OpenAPI 3.0 and 3.1 specifications, producing ready-to-use client libraries with models, API functions, and authentication support.

Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem—eliminating hand-written HTTP client boilerplate for OpenAPI-documented APIs. The MIT license is permissive. Trade-off: it is still in beta and does not support all OpenAPI features; verify that your API's spec is compatible before committing to it in production workflows.

Install

openapi-python-client on PyPI

pip

pip install openapi-python-client

uv

uv add openapi-python-client

poetry

poetry add openapi-python-client

Installing openapi-python-client

Before you install

Low friction install with a pure-Python wheel. Active maintenance (last commit 2026-08-13), 1980 repository stars, and no known vulnerabilities. Requires Python 3.11 or later. Recommended installation via pipx with --include-deps to ensure ruff is available for post-generation code cleanup.

License in practice

MIT license (permissive) means you can use generated clients freely in commercial and private projects with minimal restrictions. No license compatibility concerns for typical Python development workflows.

Quickstart

pip install openapi-python-client
openapi-python-client generate --url https://api.example.com/openapi.json
# Generates a client library with Client class, API functions, and models

Requires Python 3.11 or later. For full functionality (code formatting), install with pipx and --include-deps flag so ruff is available in your PATH.

Verify before relying

  • Extent of OpenAPI feature coverage beyond the note that 'not all OpenAPI features' are supported—which specific features are missing or incomplete
  • Performance characteristics when generating clients from very large OpenAPI documents
  • Stability of the custom template API, given the description notes it is 'beta-level' and 'undocumented and unstable'

Package facts

License MIT (permissive)
Python support supports the current Python release (<4.0,>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 9 — attrs, colorama, httpx, jinja2, pydantic, ruamel-yaml, ruff, shellingham, typer
Maintenance actively maintained — 76 days since the last release
Last repo commit
First released
Downloads 3,455,604/month — #2,617 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: openapi_python_client-0.29.0-py3-none-any.whl

Keywords: Client, Generator, OpenAPI

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Code GeneratorsTyping :: Typed

Tags

openapi client generator pythongenerate python http client from openapiopenapi 3.0 3.1 python codegentyped python api client generatoropenapi spec to python clientrest api client code generationopenapi python code generator
code-generationopenapirest-api

More Code Generators packages