Quickstart
Get from git clone to a running API endpoint in under 10 minutes.
Prerequisites
- Python 3.11+
- Docker and docker-compose
- An OpenAI or Anthropic API key
Step 1 — Clone the repo
After purchasing, you'll receive an invitation to the private GitHub repository.
git clone https://github.com/fastapikit/starter my-ai-api
cd my-ai-api
Step 2 — Configure environment
cp .env.example .env
Open .env and fill in at minimum:
# Database (docker-compose handles this locally)
DATABASE_URL=postgresql+asyncpg://user:pass@localhost:5432/aikit
# Redis (docker-compose handles this locally)
REDIS_URL=redis://localhost:6379/0
# LLM provider — choose one
OPENAI_API_KEY=sk-...
# ANTHROPIC_API_KEY=sk-ant-...
# Auth secret — generate with: openssl rand -hex 32
SECRET_KEY=your-secret-key-here
Step 3 — Start Docker services
docker-compose up -d
This starts PostgreSQL, Redis, and runs Alembic migrations automatically. The API starts on port 8000.
Step 4 — Verify
curl http://localhost:8000/healthz
# → {"status": "ok", "db": "connected", "redis": "connected"}
Open the interactive API docs at http://localhost:8000/docs.
Step 5 — Create a user and get an API key
# Register
curl -X POST http://localhost:8000/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "dev@example.com", "password": "securepassword"}'
# Get JWT token
curl -X POST http://localhost:8000/auth/token \
-d "username=dev@example.com&password=securepassword"
# Issue an API key (use the JWT token from above)
curl -X POST http://localhost:8000/api-keys \
-H "Authorization: Bearer <your-jwt>" \
-d '{"name": "dev-key", "tier": "pro"}'
Step 6 — Make your first AI call
curl http://localhost:8000/v1/chat \
-H "X-API-Key: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{"message": "Explain async Python in one sentence."}'
You'll get a streaming or buffered response, with token counts in the response headers.
Next steps
- Project structure — understand the codebase layout
- Adding an LLM provider — switch between OpenAI, Anthropic, and local models
- Deployment — deploy to Railway, Render, or Fly.io
