Generate mypy- and IDE-friendly Python API clients from OpenAPI specifications with sync/async interfaces.
FastAPI Client Generator is a Python tool that automatically creates type-safe API client libraries from OpenAPI specifications. It solves the problem of manually writing and maintaining API client code by generating mypy-compatible, IDE-friendly Python modules that handle all API interactions. The generated clients support both synchronous and asynchronous patterns and include built-in authentication handling.
Python developers working with REST APIs, particularly those using FastAPI who need to consume APIs with proper type safety and modern async/await patterns. API developers who want to provide high-quality client libraries to their users.
Developers choose this generator because it produces production-ready client code with excellent type annotations, reducing runtime errors and improving developer experience through IDE autocompletion. Unlike generic OpenAPI generators, it's specifically optimized for Python's type system and FastAPI ecosystems while remaining compatible with most OpenAPI specs.
FastAPI client generator
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Generates mypy-compatible code with full type annotations for all endpoints and models, reducing runtime errors and enhancing IDE autocompletion as shown in the example client.
Provides both synchronous and asynchronous API client interfaces, allowing flexible integration patterns demonstrated in the usage example with SyncApis and AsyncApis.
Includes support for OAuth2.0 password flow authentication, simplifying secure API access without manual implementation, as noted in the README's feature list.
Designed to work best with FastAPI-generated OpenAPI specs, ensuring accurate type mapping and seamless integration, though it supports most OpenAPI specifications.
The README warns it's still in proof-of-concept phase with no stable API, making it risky for production use due to potential breaking changes.
Admits lack of support for some OpenAPI features like discriminator fields, which can hinder compatibility with complex or non-FastAPI specs.
Generated clients require fastapi as a dependency for jsonable_encoder and OAuth models, adding unnecessary bloat for projects not using FastAPI, as mentioned in the README.