Air
The first web framework designed for AI to write. Built on Python, FastAPI, Pydantic, and HTMX. By the authors of Two Scoops of Django.
Install / Use
/learn @feldroy/AirREADME
Why use Air?
- Designed for AI to write - No magic, no implicit behavior. Comprehensive types and docstrings mean AI agents and editors understand the API without external docs
- Powered by FastAPI - Your FastAPI knowledge and routes carry over. Serve your API and web pages from one project
- Fast to code - Tons of intuitive shortcuts and optimizations designed to expedite coding HTML with FastAPI
- Air Tags - Easy to write and performant HTML content generation using Python classes to render HTML
- Jinja Friendly - No need to write
response_class=HtmlResponseandtemplates.TemplateResponsefor every HTML view - Mix Jinja and Air Tags - Jinja and Air Tags both are first class citizens. Use either or both in the same view!
- HTMX friendly - We love HTMX and provide utilities to use it with Air
- HTML form validation powered by pydantic - We love using pydantic to validate incoming data. Air Forms provide two ways to use pydantic with HTML forms (dependency injection or from within views)
- Easy to learn yet well documented - Hopefully Air is so intuitive and well-typed you'll barely need to use the documentation. In case you do need to look something up we're taking our experience writing technical books and using it to make documentation worth boasting about
Website: <a href="https://airwebframework.org" target="_blank">https://airwebframework.org</a>
Documentation: <a href="https://docs.airwebframework.org" target="_blank">https://docs.airwebframework.org</a>
Source Code: <a href="https://github.com/feldroy/air" target="_blank">https://github.com/feldroy/air</a>
[!CAUTION] Air is in alpha. APIs may change between releases.
Installation
Install Air with uv:
uv venv
source .venv/bin/activate
uv init
uv add air
Install optional features (with uv add)
You can install each optional feature (extras) like this:
-
Standard — FastAPI’s recommended extras
uv add "air[standard]"
Built for AI-Assisted Development
Air's API is fully typed and comprehensively documented in-source. AI coding assistants can understand the framework by reading the installed package, without fetching external documentation.
For AI context, use llms-full.txt (complete docs) or llms.txt (index with links to individual sections).
Third-party context providers: Code Wiki by Google, DeepWiki by Devin.
Two Ways to Build
Air gives you two paths to HTML. Start with whichever fits your workflow.
Start with HTML
Have your AI generate an HTML mockup, or write one yourself. Drop it in a template, wire it up with minimal Python:
templates/index.html:
<!doctype html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>Hello, world!</h1>
</body>
</html>
main.py:
import air
app = air.Air()
jinja = air.JinjaRenderer(directory="templates")
@app.page
def index(request: air.Request):
return jinja(request, name="index.html")
Start with Python
Write HTML as typed Python classes. Your editor autocompletes attributes, your type checker validates nesting:
main.py:
import air
app = air.Air()
@app.page
def index():
return air.Html(air.H1("Hello, world!"))
Run either one
air run
Open http://127.0.0.1:8000 to see the result. Both paths produce the same thing: a working web page.
Use FastAPI Alongside Air
Air is powered by FastAPI. You get Air's HTML tools for your pages and FastAPI's full capabilities for your API, all in one app.
Mount a FastAPI sub-app
Two separate apps, clean split. Air serves pages, FastAPI serves your API at /api.
from fastapi import FastAPI
import air
app = air.Air()
api = FastAPI()
@app.page
def index():
return air.Html(
air.Head(air.Title("My Website")),
air.Body(
air.H1("My Website"),
air.P(air.A("API Docs", target="_blank", href="/api/docs")),
),
)
@api.get("/")
def api_root():
return {"message": "My Website is powered by FastAPI"}
# Mount the FastAPI app under /api
app.mount("/api", api)
Wrap a single FastAPI instance
One app. Air adds its features on top. You get OpenAPI docs, response_model, and WebSockets alongside your pages.
from fastapi import FastAPI
import air
fastapi_app = FastAPI()
app = air.Air(fastapi_app=fastapi_app)
@app.page
def index():
return air.H1("Hello, world!")
@app.fastapi_app.get("/api/users")
def api_users():
return [{"name": "Audrey M. Roy Greenfeld"}]
Sponsors
Maintenance of this project is made possible by all the contributors and sponsors. If you would like to support this project and have your avatar or company logo appear below, please sponsor us. 💖💨
<!-- SPONSORS --> <!-- SPONSORS -->Consider this low-barrier form of contribution yourself. Your support is much appreciated.
Contributing
[!IMPORTANT] Have a feature idea? Open an issue first. Air's core is intentionally minimal: new features are built as separate packages in the Air ecosystem, not added to this base package.
For guidance on setting up a development environment and how to make a contribution to Air, see Contributing to Air.
Contributors
Thanks to all the contributors t
Related Skills
claude-opus-4-5-migration
84.1kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
340.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
diffs
340.2kUse the diffs tool to produce real, shareable diffs (viewer URL, file artifact, or both) instead of manual edit summaries.
TrendRadar
49.9k⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。
