Overview
FastAPI is a web framework for building APIs in Python using standard type hints. You declare path, query and body parameters as typed function arguments or Pydantic models, and FastAPI validates incoming data, converts it, serializes responses and generates OpenAPI and JSON Schema documents with interactive docs at /docs. Starlette provides the web layer and Pydantic the data layer.
Handlers can be async def or plain def; FastAPI runs sync handlers in a thread pool, and its docs explain when to use each (most database libraries without await support should use plain def). Dependency injection handles database sessions, auth and shared logic. The fastapi CLI runs a development server with reload and a production server.
FastAPI does not include an ORM, admin or auth system. The docs pair it with SQLModel or SQLAlchemy for databases, and it is widely used for ML model serving: its homepage quotes teams at Microsoft, Uber and Netflix.
Its creator, Sebastian Ramirez, started a company that runs FastAPI Cloud, where fastapi deploy ships an app to a managed host. It is in public beta with a free Hobby plan and Pro at $20 per seat per month.
Pricing and plans
Free tier · no card
The framework is free and open source. FastAPI Cloud Hobby is free: 3 apps, 1 custom domain, 0.1 CPU / 512 MB (burst to 0.5 CPU), 1-day logs and metrics, 1 team member
At the limit Not stated The vendor does not say what happens at the limit, or we have not found it yet.
| Plan | Price | What you get |
|---|---|---|
| Framework | Free | Open source (MIT) |
| FastAPI Cloud Hobby | $0/mo | 3 apps, 1 custom domain, 0.1 CPU / 512 MB, 1-day logs and metrics |
| FastAPI Cloud Pro | $20/seat/mo | 25 apps, 20 custom domains, 14-day logs and metrics, up to 10 teammates, RBAC, priority Slack support |
| FastAPI Cloud Enterprise | Custom | Being shaped with customers: SSO/SAML, audit logs, SLA, compliance |
What it does
- Type-hint validation
- Pydantic validates and converts request data declared with Python type hints.
- Automatic OpenAPI docs
- Interactive Swagger UI and ReDoc generated from your code.
- Dependency injection
- Reusable dependencies for database sessions, auth and shared logic.
- Async and sync
- Mix async def and def handlers; sync ones run in a thread pool.
- FastAPI CLI
- fastapi dev and fastapi run for development and production servers.
- FastAPI Cloud
- Paid host from the FastAPI team: one-command deploys, autoscaling and custom domains.
Strengths and limitations
Strengths
- Very little code for validated, documented JSON APIs
- Excellent editor completion from type hints
- Standards-based: OpenAPI and JSON Schema
- Large ecosystem and many tutorials, especially for ML serving
Limitations
- No built-in ORM, admin panel or user auth; you assemble them (the docs suggest SQLModel or SQLAlchemy)
- Mixing async code with blocking libraries hurts performance; the docs ask you to choose def or async def per handler carefully
- API-focused: server-rendered HTML pages need Jinja templates and more manual work than Django
- FastAPI Cloud is still in beta, with scale-to-zero, rollbacks and usage billing marked as coming soon
Who it suits
Good for
- JSON APIs and microservices in Python
- Serving machine-learning models
- Teams that want OpenAPI docs generated from code
Look elsewhere if
- Content sites or apps that want an admin and ORM built in (see Django)
- Teams wanting one opinionated full-stack structure
Alternatives to FastAPI
| Tool | From | Free option | Stages |
|---|---|---|---|
| Encore Backend framework with infrastructure from code | $49/mo | Free tier | |
| Laravel Batteries-included PHP framework | $5/mo | ||
| Ruby on Rails Full-stack Ruby web framework | — | ||
| Fastify High-performance Node.js web framework | — | ||
| Django Batteries-included Python web framework | — | ||
| ASP.NET Core .NET web framework | — |
Questions
Is FastAPI free?
Yes, the framework is MIT licensed. FastAPI Cloud, the team's hosting service, has a free Hobby plan and a $20/seat Pro plan.
Should I use FastAPI or Django?
FastAPI suits typed JSON APIs; Django suits full web apps that need an ORM, admin and auth built in.
Does FastAPI include an ORM?
No. The docs use SQLModel or SQLAlchemy.
Should FastAPI handlers be async?
Use async def when the libraries you call support await; otherwise use def, which FastAPI runs in a thread pool.
Sources read for this page