The batteries-included FastAPI framework. Admin, auth, migrations, jobs and streaming out of the box — so you ship the backend instead of the plumbing.
FastAPI gives you a superb routing and validation layer and then stops. Every team builds the same next thing by hand: an admin, a login, Alembic wiring, a job queue, API keys. GreatAPI is that layer, and it is the same one whether you are serving a CRUD API or an LLM.
pip install greatapi
greatapi startproject myapp && cd myapp
cp .env.example .env
greatapi migrate && greatapi createsuperuser
greatapi runserver
You now have an API on http://127.0.0.1:8000, OpenAPI docs at /docs, and a
working admin at /admin.
# main.py
from greatapi import GreatAPI
app = GreatAPI(title="myapp", installed_apps=["blog"])
# blog/admin.py
from greatapi import admin
from blog.models import Post
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ("id", "title", "published", "created_at")
search_fields = ("title", "body")
That is the whole registration. greatapi startapp blog writes the model,
schemas, repository, router and admin file, and adds the app to
INSTALLED_APPS, so it serves requests and appears in the admin without
another edit.
What you get
| Admin | Real CRUD over any model, with search, pagination, forms generated from your columns, light/dark, and no CDN. |
| Auth | Argon2 passwords, HttpOnly sessions, CSRF, and a login that is not an account-enumeration oracle. |
| Migrations | Alembic behind greatapi makemigrations and greatapi migrate. |
| Jobs | A database-backed queue with retries and backoff, running in-process. No Redis, no Celery. |
| API keys | Scopes, per-key rate limits and monthly spend caps, managed from the admin. |
| Streaming | SSE done properly: heartbeats, correct framing, and cancellation when the client leaves. |
| Async | SQLAlchemy 2.0 AsyncSession throughout, so long-lived connections do not eat a thread each. |
The AI extra
pip install "greatapi[ai]"
from greatapi import ai
@app.post("/chat")
async def chat(request: Request, body: ChatIn):
return ai.sse(ai.stream("anthropic:claude-sonnet-5", body.prompt), request=request)
@ai.tool
async def lookup_order(order_id: int) -> dict:
"""Fetch an order by its id."""
...
agent = ai.Agent(model="anthropic:claude-sonnet-5", tools=[lookup_order], max_steps=8)
@app.post("/agent")
async def run(request: Request, body: ChatIn):
return ai.sse(agent.stream(body.prompt), request=request)
Tool schemas come from your type hints, so there is one source of truth. Every
call and every agent step is recorded with its model, tokens, cost, latency and
outcome, and shows up at /admin/usage — an agent run opens as a trace rather
than a number in a log line.
Models are addressed as provider:model:
| String | Needs |
|---|---|
echo:demo |
nothing — offline, deterministic, no API key |
anthropic:claude-sonnet-5 |
greatapi[anthropic] |
openai:gpt-5 |
greatapi[openai] |
local:llama3.2 |
greatapi[local] — httpx only; Ollama, vLLM, LM Studio, llama.cpp |
Try it without signing up for anything:
git clone https://github.com/sahajrajmalla/greatapi && cd greatapi
make install && make demo
Installing
pip install greatapi # the framework. no LLM dependency at all
pip install "greatapi[ai]" # + every provider and the agent tooling
pip install "greatapi[anthropic]" # + one provider
pip install "greatapi[local]" # + self-hosted models, httpx only
pip install "greatapi[postgres]" # + asyncpg
The AI code ships in the base wheel; only third-party SDKs live in the extras.
import greatapi.ai always works, and reaching for a provider you have not
installed tells you exactly what to install rather than raising an ImportError
from four frames down.
Commands
greatapi startproject <name> # a project that runs
greatapi startapp <name> # an app, registered for you
greatapi runserver --port 8000 # the dev server
greatapi makemigrations -m "message" # a migration from your model changes
greatapi migrate # apply them
greatapi createsuperuser # an admin account
greatapi routes # every route in the app
greatapi generate-secret # a signing key
Configuration
Everything is read from the environment or .env, prefixed GREATAPI_:
GREATAPI_SECRET_KEY=... # required; greatapi generate-secret
GREATAPI_DATABASE_URL=postgresql+asyncpg://u:p@host/db # any async SQLAlchemy URL
GREATAPI_DEBUG=false
SECRET_KEY has no default. With DEBUG off, a missing one stops the app
starting and tells you how to make one.
Documentation
https://greatapi.readthedocs.io — quickstart, tutorial, admin, migrations, jobs, API keys, AI providers, agents, deployment, and the full settings reference.
Upgrading from 1.x? See MIGRATION.md.
Contributing
git clone https://github.com/sahajrajmalla/greatapi && cd greatapi
make install
make check # ruff, mypy, and the test suite
make demo # see it work
Details in CONTRIBUTING.md. Issues and pull requests are welcome; good first issues are labelled.
Security
Please report vulnerabilities privately — see SECURITY.md.
Credits
Built by Sahaj Raj Malla.
Standing on FastAPI, Starlette, Pydantic, SQLAlchemy and Alembic.
MIT licensed.
Metadata
Release files for greatapi 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| greatapi-2.0.0.tar.gz | 139.0 kB | Without provenance | Details for greatapi-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| greatapi-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for greatapi-2.0.0-py3-none-any.whl |
Total release size: 280.0 kB
Release files / greatapi-2.0.0.tar.gz
| Download URL | greatapi-2.0.0.tar.gz |
|---|---|
| Size | 139.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b9008f205a051415d7f3e3912b8a7c508ff70051a6e4005a94dcc418a8d815b
|
|
BLAKE2b-256 checksum How to use checksums |
5a89d55fbb038ca943ab5b0e7fd3df56754f5fac71f8dbd06933360551badf2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / greatapi-2.0.0-py3-none-any.whl
| Download URL | greatapi-2.0.0-py3-none-any.whl |
|---|---|
| Size | 141.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebf38a5992e9a0b84d6652beb4671feb4e5ad3e5d29793723adc2aeca5ad81aa
|
|
BLAKE2b-256 checksum How to use checksums |
1682ab4661ee3f7b57ac4480413b924b23bef030f1a88790e5654e2d9852e839
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for greatapi 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.