A complete SaaS solution for proxying requests across 28+ LLM providers with intelligent routing, automatic failover, user authentication, API key management, usage tracking, and Stripe subscription billing.
- Intelligent Routing: Smart load balancing across 28+ free LLM providers
- Automatic Failover: Seamless switching when providers are down
- User Authentication: Secure registration, login, and password recovery
- API Key Management: Generate, revoke, and rotate API keys per user
- Usage Dashboard: Real-time metrics on tokens consumed, requests per day, and provider usage
- Stripe Integration: Freemium model with Free, Pro ($19/mo), and Business ($99/mo) plans
- Webhook Handling: Automatic subscription activation, pauses, and cancellations
- Rate Limiting: Token limits per plan (Free: 50K, Pro: 500K, Business: 5M tokens/month)
- Request Logging: Complete audit trail of all proxy requests
- Framework: Next.js 14 with App Router
- Language: TypeScript
- Database: Vercel Postgres (serverless)
- Cache: Vercel KV (Redis) for rate limiting and health checks
- Payments: Stripe Checkout + Webhooks
- Styling: Tailwind CSS
- Charts: Recharts
- Icons: Lucide React
- Node.js 18+ installed
- Vercel account
- Stripe account
- Vercel Postgres database provisioned
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/llmflow.git
cd llmflow- Install dependencies:
npm install- Copy environment variables:
cp .env.example .env.local-
Configure your environment variables (see
.env.examplefor details) -
Run development server:
npm run dev- Open http://localhost:3000 in your browser
See .env.example for all required environment variables with detailed descriptions.
After registration, you'll receive an API key. Use it to make requests to /api/proxy:
curl -X POST https://your-app.vercel.app/api/proxy \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Hello!"}]}'The proxy will intelligently route your request to the best available LLM provider.
| Plan | Price | Monthly Tokens | Extra Tokens |
|---|---|---|---|
| Free | $0 | 50,000 | N/A |
| Pro | $19/mo | 500,000 | N/A |
| Business | $99/mo | 5,000,000 | $0.01/token |
llmflow/
├── app/
│ ├── (auth)/ # Authentication pages
│ ├── (dashboard)/ # Protected dashboard pages
│ ├── (marketing)/ # Public marketing pages
│ └── api/ # API routes
│ ├── auth/ # Authentication endpoints
│ ├── keys/ # API key management
│ ├── stripe/ # Stripe webhooks & checkout
│ └── proxy/ # Main proxy endpoint
├── components/
│ ├── ui/ # Reusable UI components
│ ├── auth/ # Auth-related components
│ ├── dashboard/ # Dashboard components
│ └── marketing/ # Marketing page components
├── lib/
│ ├── db/ # Database utilities
│ ├── auth/ # Authentication logic
│ ├── stripe/ # Stripe integration
│ ├── proxy/ # Proxy routing & failover
│ └── validators/ # Zod schemas
├── hooks/ # Custom React hooks
└── types/ # TypeScript type definitions
The proxy supports 28+ free LLM providers including:
- OpenAI-compatible APIs
- Anthropic Claude
- Google Gemini
- Meta Llama
- Mistral AI
- And many more...
Providers are automatically health-checked and routed based on availability and performance.
The application uses Vercel Postgres with the following tables:
users: User accounts, API keys, and subscription statususage_logs: Request logs with provider, tokens, and timestampssubscriptions: Stripe subscription data and billing statusapi_keys: User API keys with creation/revocation status
- Passwords hashed with bcrypt
- JWT-based session management
- HTTP-only cookies for authentication
- API key validation on every proxy request
- Rate limiting enforced at multiple levels
- Stripe webhook signature verification
- Push your code to GitHub
- Click the "Deploy to Vercel" button above
- Configure environment variables during deployment
- Set up Stripe webhooks:
- Go to Stripe Dashboard > Developers > Webhooks
- Add endpoint:
https://your-app.vercel.app/api/stripe/webhook - Select events:
checkout.session.completed,customer.subscription.updated,customer.subscription.deleted - Copy the webhook secret to
STRIPE_WEBHOOK_SECRET
- Verify database connection
- Test user registration and login
- Create Stripe products and prices
- Configure Stripe webhooks
- Test subscription flow end-to-end
- Monitor initial proxy requests
For support, please open an issue on GitHub or contact support@llmflow.dev
MIT License - see LICENSE file for details
Built with ❤️ by solo founders, for solo founders.