Generate typed HTTP clients from FastAPI apps automatically.
This library inspects your FastAPI app and produces a fully usable async client with request/response models โ ideal for service-to-service communication or rapid prototyping.
- Extracts all FastAPI routes.
- Generates:
- Request/response models
- Method handlers (with typed parameters)
- A reusable HTTP client class
- Provides a download endpoint (
/fastroutes) and a CLI tool to fetch generated code.
pip install git+https://github.com/draew6/fastroutesfrom fastapi import FastAPI
from fastroutes import FastRoutes
app = FastAPI()
FastRoutes(app, name="MyVeryNiceClient").add_route_to_fastapi()This will add a /fastroutes endpoint that servers your generated client code.
fastroutes http://localhost:8000/fastroutes output_file.pyThis will save the generated code to output_file.py.