Unified infrastructure API for AI agents - payments, billing, identity, and usage tracking in one simple API.
SwiftAPI provides the infrastructure layer that AI agent developers need to monetize their agents and manage users at scale. Built on Stripe, PostgreSQL, and Redis for production-grade reliability.
- Payment Processing - Accept payments with 2% fee or $0.05/call (whichever less)
- Subscription Billing - Tiered plans from Free to Enterprise
- API Key Management - Secure authentication for AI agents
- Usage Tracking - Real-time metering and rate limiting
- Developer Dashboard - Monitor usage, manage keys, track revenue
curl -X POST https://api.getswiftapi.com/auth/signup \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com","password":"secure_password"}'Python:
pip install swiftapiTypeScript:
npm install @swiftapi/sdkPython:
from swiftapi import SwiftAPI
client = SwiftAPI(api_key="sk_your_api_key")
user = client.get_current_user()
print(f"Tier: {user.tier}")TypeScript:
import { SwiftAPI } from '@swiftapi/sdk';
const client = new SwiftAPI({ apiKey: 'sk_your_api_key' });
const user = await client.getCurrentUser();
console.log(`Tier: ${user.tier}`);| Tier | Price/Month | API Calls | Rate Limit |
|---|---|---|---|
| Free | $0 | 1,000 | 10/min |
| Indie | $49 | 10,000 | 100/min |
| Pro | $199 | 100,000 | 500/min |
| Enterprise | $999 | Unlimited | 5,000/min |
Transaction Fees: 2% or $0.05 per API call (whichever is less)
┌─────────────────┐
│ Next.js │ Developer Dashboard
│ Frontend │ (React, TailwindCSS)
└────────┬────────┘
│
▼
┌─────────────────┐
│ FastAPI │ REST API
│ Backend │ (Python, Uvicorn)
└────────┬────────┘
│
├────────────────┐
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ PostgreSQL │ │ Redis │
│ (SQLAlchemy)│ │ (Rate Limit)│
└─────────────┘ └─────────────┘
│
▼
┌─────────────────┐
│ Stripe │ Payment Processing
│ Connect │ (2% fee capture)
└─────────────────┘
Backend:
- FastAPI (Python)
- PostgreSQL (SQLAlchemy ORM)
- Redis (Rate limiting)
- Stripe (Payments)
- JWT (Authentication)
Frontend:
- Next.js 14
- TypeScript
- TailwindCSS
- Recharts (Analytics)
SDKs:
- Python (requests, pydantic)
- TypeScript (axios)
swiftapi/
├── backend/ # FastAPI backend
│ ├── main.py # API endpoints
│ ├── models.py # Database models
│ ├── auth.py # Authentication
│ ├── stripe_service.py # Payment processing
│ ├── rate_limiter.py # Rate limiting
│ └── database.py # Database connection
├── frontend/ # Next.js frontend
│ ├── src/
│ │ ├── pages/ # Dashboard pages
│ │ ├── components/ # React components
│ │ ├── lib/ # API client
│ │ └── types/ # TypeScript types
│ └── package.json
├── sdk/
│ ├── python/ # Python SDK
│ └── typescript/ # TypeScript SDK
└── docs/ # Documentation
├── API_REFERENCE.md
└── QUICKSTART.md
cd backend
pip install -r requirements.txt
cp .env.example .env
# Configure DATABASE_URL, STRIPE_SECRET_KEY, etc.
uvicorn main:app --reloadcd frontend
npm install
cp .env.example .env.local
npm run devBackend (.env):
DATABASE_URL=postgresql://user:password@localhost:5432/swiftapi
REDIS_URL=redis://localhost:6379
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
SECRET_KEY=your-secret-key-hereFrontend (.env.local):
NEXT_PUBLIC_API_URL=http://localhost:8000Frontend:
vercel --prodBackend: Deploy to any Python-compatible platform:
- Railway
- Render
- Fly.io
- AWS Lambda (with Mangum)
- Primary: getswiftapi.com
- API: api.getswiftapi.com
- Alternative: swiftapi.ai
POST /auth/signup- Create accountPOST /auth/login- Get access tokenGET /auth/me- Get current user
POST /api-keys- Create API keyGET /api-keys- List all keysDELETE /api-keys/{id}- Revoke key
POST /subscriptions- Upgrade tier
POST /payments- Process payment
GET /usage- Get statistics
# AI agent charges user for service
transaction = client.create_payment(
amount=9.99,
metadata={"agent_id": "agent_123", "service": "analysis"}
)# Track usage and bill monthly
usage = client.get_usage()
monthly_bill = usage.calls.month * 0.01 # $0.01 per call# Each customer gets isolated API key
customer_key = client.create_api_key(f"Customer_{id}")- JWT authentication with HS256
- API keys with Bearer token format
- Stripe webhook signature verification
- Rate limiting by tier
- PostgreSQL with parameterized queries
- HTTPS required in production
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
See CONTRIBUTING.md for details.
- Documentation: https://docs.getswiftapi.com
- GitHub Issues: https://github.com/theonlypal/swiftapi/issues
- Email: support@getswiftapi.com
- Discord: https://discord.gg/swiftapi
Response Times:
- Free: 48 hours
- Indie: 24 hours
- Pro: 4 hours
- Enterprise: 1 hour + phone
MIT License - see LICENSE for details.
SwiftAPI is built on the shoulders of giants:
- FastAPI - Modern Python web framework
- Next.js - React framework
- Stripe - Payment processing
- PostgreSQL - Database
- Redis - Caching and rate limiting
- Core API infrastructure
- Payment processing
- Subscription management
- Dashboard
- Python SDK
- TypeScript SDK
- Webhooks system
- Usage-based billing
- Team management
- OAuth 2.0 (KYA - Know Your Agent)
- GraphQL API
- Mobile SDKs (iOS, Android)
Built with focus by Rayan Pal