Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 4 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

FastAPI

Build the server side of an app in Python.

HTTP servers and APIsPYPI

GitHubWebsite

1. License

“Permission is hereby granted, free of charge, to any person obtaining a copy of this software”

Any use, including paid and closed-source apps.

github.com/fastapi/fastapi/blob/master/LICENSE

From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error

What FastAPI does

FastAPI is a free Python framework for the server part of a website or app, the part that receives orders, sign-ups or uploads and answers them. You describe what each request must contain with plain Python types. FastAPI then checks incoming data, sends clear errors and makes a live docs page where you can try every request.

What people build with it

Server for a web or mobile app

Your front end or phone app sends orders, sign-ups and searches to a small Python server that checks each one and answers.

A docs page to try every request

Open /docs in the browser and send test requests by hand; front-end developers and AI assistants see what the server expects.

Photo and file uploads

People upload a photo or a document from a form; your server receives it without filling the memory with big files.

Send the email after answering

After a sign-up the visitor gets the answer at once, and the welcome email goes out a moment later in the background.

Put an AI model behind a web address Idea

Wrap a Python model or an LLM call in one route, so your site, a chat widget or another service can ask it questions.

Read a slow file in the background

A user uploads a big spreadsheet; the server answers "accepted" right away and works through the file afterwards.

FastAPI popularity

91 / 100
Gid Score, #8 overall
136M
downloads a week, pypi
105K
GitHub stars
465
agent projects use it
FastAPI: downloads per weekPyPI, fastapi 135,345,469
FastAPI: GitHub starsfastapi/fastapi 104,951

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How FastAPI is used

  • FastAPI is a dependency in 465 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (28.7% of the 1,623 Python ones), #2 of 102 in http servers and apis.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 3,148; those are left out of every share on this page.
  • The most used alternative in our scan is Flask (106 projects).
  • Projects that use it most often also use Uvicorn (92.5%), Pydantic (63.4%), python-dotenv (48.0%).
  • It is more common in projects set up for OpenClaw (10.5%) than for OpenAI Codex (4.1%).

By coding agent

248 projects, 8.2%
215 projects, 6.6%
174 projects, 7.1%
35 projects, 10.5%
29 projects, 6.1%
19 projects, 4.1%
17 projects, 6.1%
15 projects, 4.4%

Often used with

In 92.5% of its projects
In 63.4% of its projects
In 48.0% of its projects
In 36.3% of its projects
In 33.1% of its projects
In 31.8% of its projects
In 30.5% of its projects
In 29.7% of its projects

FastAPI in practice

Strengths

Plain Python types instead of a schema language

Parameters, query values and bodies are declared once, as function parameters with normal type hints. The README stresses that there is no new syntax or library-specific classes to learn for this.

Validation with clear errors, down into nested JSON

If a request does not match the declared types, FastAPI rejects it with an error message. The README says this also applies to deeply nested JSON objects.

Two docs UIs at /docs and /redoc

Every app serves interactive documentation in Swagger UI and in ReDoc. Both update as you add endpoints. In Swagger UI you can fill in parameters and send real requests with "Try it out".

OpenAPI output that other tools can read

The maintainers say FastAPI is based on and "fully compatible with" OpenAPI and JSON Schema. The generated OpenAPI document can feed client code generators for other languages.

Watch out for

Speed-to-code and bug figures are internal estimates

The README claims about 200% to 300% faster feature development and about 40% fewer developer-induced errors. A footnote says these numbers come from the team's own internal tests, not from an independent study.

0.143.0 changed OpenTelemetry defaults

The project is still on 0.x versions, and release 0.143.0 is marked as breaking. Automatic exporter setup from <code>OTEL_*</code> variables is now opt-in. Apps that relied on it must set a flag. Apps that configure their own providers and exporters need no changes.

Starlette and Pydantic sit underneath

FastAPI delegates the web layer to Starlette and data handling to Pydantic. Request bodies are Pydantic models, so you will be working with Pydantic directly as well as with FastAPI.

Path, query and a Pydantic request body

from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):
    name: str
    price: float
    is_offer: bool | None = None


@app.get("/")
def read_root():
    return {"Hello": "World"}


@app.get("/items/{item_id}")
def read_item(item_id: int, q: str | None = None):
    return {"item_id": item_id, "q": q}


@app.put("/items/{item_id}")
def update_item(item_id: int, item: Item):
    return {"item_name": item.name, "item_id": item_id}

More about FastAPI

Funding
  • GitHub Sponsors: https://github.com/tiangolo
  • 113 GitHub sponsors

See all

Agent Skills for it
  • fastapi-python: Expert in FastAPI Python development with best practices for APIs and async operations
  • fastapi-templates: Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new
  • fastapi-expert: Use when building high-performance async Python APIs with FastAPI and Pydantic V2. Invoke to create REST endpoints, define Pydantic models,
  • fastapi-python: Expert in FastAPI Python development with best practices for APIs and async operations
  • fastapi-router-py: Create FastAPI routers with CRUD operations, authentication dependencies, and proper response models. Use when building REST API endpoints,
  • fastapi-pro: Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async p

See all

Head to head
Packages around it
  • fastapi-mcp: MCP server from FastAPI apps
  • fastapi-cli: fastapi dev / run commands
  • fastapi-cloud-cli: FastAPI Cloud deploy CLI
  • fastapi-mail: Email sending
  • fastapi-cache2: Response caching
  • fastapi-users: User accounts and auth
More in HTTP servers and APIs

Alternatives

FastAPI This page

MITGid 91136M/wk

Flask

Pick Flask for a classic Python site with server-made HTML pages and a large plugin collection, where automatic request checking and docs matter less.

BSD-3-ClauseGid 8540.4M/wk

Django

Pick Django when you want a full Python site kit with database models, an admin panel and user accounts built in.

Express

Pick Express when the server side of your project is JavaScript on Node.js rather than Python.

Starlette

Lightweight ASGI web framework for building Python APIs and web applications.

BSD-3-ClauseGid 78174M/wk

Tornado

High-performance Python web framework and async networking library for building servers.

Apache-2.0Gid 7629.1M/wk

Compare FastAPI with another tool

Get started

Tell your AI assistant

“Use FastAPI (pin fastapi[standard]==0.162.4, Python 3.10+) to build a small server with Pydantic models for each request, clear 422 errors for bad input, an upload route, and the /docs page for testing.”

  1. Install FastAPI with its standard extras (server, form and upload parsing, the fastapi command) into a virtual environment.

    uv add "fastapi[standard]"

    From github.com/fastapi/fastapi/blob/master/README.md

  2. Write main.py with one route that returns a dictionary.

    from fastapi import FastAPI
    
    app = FastAPI()
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    

    From github.com/fastapi/fastapi/blob/master/README.md

  3. Run it with fastapi dev while you build, and with fastapi run on the real server.

    fastapi dev

    From fastapi.tiangolo.com/fastapi-cli/

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## FastAPI
- Install with `uv add "fastapi[standard]"`, keeping the extra in quotes. With pip, install `fastapi[standard]` inside a virtual environment.
- Use `fastapi dev` for local work (auto-reload). Use `fastapi run` for production.
- Declare path, query and body inputs as typed function parameters. A default of `= None` makes a parameter optional. Without it the parameter is required.
- Model JSON request bodies as Pydantic `BaseModel` classes and take them as a typed parameter.
- Use `async def` for a path function only if your code uses `async` / `await`. Otherwise use plain `def`.
- On 0.143.0 or later, if the app relies on `OTEL_*` environment variables for exporters, set `FASTAPI_OTEL_AUTO_CONFIGURE=true` or pass `telemetry={"auto_configure": True}`.
- Check the generated docs at `/docs` or `/redoc` after adding endpoints.

Mistakes to avoid

pip install fastapi, then fastapi dev or a route with UploadFile / Form
pip install "fastapi[standard]==0.162.4" (quoted), or add python-multipart yourself

The plain package leaves out the server, the fastapi command and the form parser; uploads need python-multipart.

fastapi>=0.100 or an unpinned fastapi in requirements.txt
fastapi[standard]==0.162.4, then read the release notes before each minor upgrade

Minor versions carry breaking changes; 0.147 to 0.162 changed how omitted booleans, empty strings and unselected files in forms are read.

async def routes that call a blocking library (requests, most database drivers)
Use plain def for routes that call blocking code; keep async def for code that awaits

Blocking calls inside async def stop the whole server from answering other requests meanwhile.

Query(custom="value") or other unknown keyword arguments copied from older examples
Query(json_schema_extra={"custom": "value"})

Since 0.155.0 unknown keyword arguments raise TypeError at startup.

CORSMiddleware with allow_origins=["*"] and cookies or Authorization headers
List your real front-end origins and set allow_credentials=True

A wildcard origin excludes requests that carry credentials, so logged-in calls from the browser fail.

Questions

Which Python version do I need?

Python 3.10 or newer for FastAPI 0.162.4; support for 3.9 was dropped in February 2026.

Do I need async and await?

No. Plain def functions work; the docs say to use plain def when a library you call cannot await.

Does FastAPI send data about my app anywhere?

Not by default. It records traces and metrics, but since 0.143.0 it sends them only when you turn on automatic setup and give it an address.

Can I use it in a paid product?

Yes. It is MIT-licensed; keep the license notice with copies you ship.