Skip to content
perria080925-botPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LLMFlow - Multi-LLM Proxy SaaS

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.

Deploy to Vercel

Deploy to Vercel

Features

  • 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

Tech Stack

  • 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

Quick Start

Prerequisites

  • Node.js 18+ installed
  • Vercel account
  • Stripe account
  • Vercel Postgres database provisioned

Local Development

  1. Clone the repository:
git clone https://github.com/YOUR_USERNAME/llmflow.git
cd llmflow
  1. Install dependencies:
npm install
  1. Copy environment variables:
cp .env.example .env.local
  1. Configure your environment variables (see .env.example for details)

  2. Run development server:

npm run dev
  1. Open http://localhost:3000 in your browser

Environment Variables

See .env.example for all required environment variables with detailed descriptions.

API Usage

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.

Plans & Pricing

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

Project Structure

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

Supported LLM Providers

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.

Database Schema

The application uses Vercel Postgres with the following tables:

  • users: User accounts, API keys, and subscription status
  • usage_logs: Request logs with provider, tokens, and timestamps
  • subscriptions: Stripe subscription data and billing status
  • api_keys: User API keys with creation/revocation status

Security

  • 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

Deployment

Deploy to Vercel

  1. Push your code to GitHub
  2. Click the "Deploy to Vercel" button above
  3. Configure environment variables during deployment
  4. 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

Post-Deployment Checklist

  • 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

Support

For support, please open an issue on GitHub or contact support@llmflow.dev

License

MIT License - see LICENSE file for details


Built with ❤️ by solo founders, for solo founders.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages