A full-stack multi-provider AI chat application that allows you to interact with multiple LLM providers from a single unified interface β with per-user authentication, isolated chat history, and a premium subscription tier.
Available on:
π https://multillm.net/
This project combines:
- β‘ A streaming FastAPI backend (Dockerized)
- π¨ A premium Next.js frontend
- π PostgreSQL persistence
- π Firebase Authentication (Google OAuth + Email/Password)
- π³ Dockerized backend environment
- π Multi-chat session management per user
- π§ Dynamic model/provider routing
- π³ Premium billing via Polar (polar.sh)
- π Real-time Deep Search via Tavily (premium)
The platform allows users to:
- Sign in via Google OAuth or Email/Password (Firebase Auth)
- Chat with multiple AI providers (OpenAI, Anthropic, Groq, OpenRouter, Gemini)
- Stream responses token-by-token in real time
- Manage multiple chat sessions isolated per user
- Delete and share chats
- Switch models per conversation
- Render Markdown (GFM support)
- Copy responses with animated feedback
- Use a collapsible sidebar UI
- Persist conversations in PostgreSQL scoped to authenticated user
- Upload and analyze files and images (PDFs, code, screenshots)
- Use Deep Search to ground any model with live web results (premium)
- Subscribe to Premium for advanced models, higher limits, and exclusive features
This is a production-style architecture, not just a demo chatbot.
multi-llm-platform/
β
βββ apps/
β βββ api/ # FastAPI backend (Dockerized)
β β βββ main.py
β β βββ polar_billing.py # Polar subscription billing
β β βββ user_service.py
β β βββ clients.py # Provider SDK clients
β β βββ services/
β β β βββ web_search_client.py # Tavily Deep Search
β β βββ requirements.txt
β β βββ Dockerfile
β β βββ ...
β β
β βββ web/ # Next.js frontend
β βββ src/
β β βββ app/
β β β βββ page.tsx # Main chat page
β β β βββ premium/ # Upgrade + cancel flows
β β β βββ pricing/ # Public pricing page
β β βββ components/
β β βββ chat/
β β βββ Composer.tsx # Input + Deep Search toggle
β βββ package.json
β βββ ...
β
βββ .gitignore
βββ README.md
Authentication is handled by Firebase Auth on the frontend. The backend verifies identity server-side using the Firebase Admin SDK.
- User signs in via Google OAuth or Email/Password on the frontend
- Firebase issues a JWT ID token on the client
- The frontend attaches the token to every API request (
Authorization: Bearer <token>) - The FastAPI backend verifies the token using the Firebase Admin SDK
- All DB queries are scoped to the verified
user_idβ chats are fully isolated per user
- π΅ Google OAuth β one-click sign-in
- π§ Email + Password β standard registration/login
The frontend is built using modern React architecture and runs locally during development.
- Next.js 16 (App Router)
- React 19
- TypeScript
- Tailwind CSS
- Firebase SDK (Auth)
- React Markdown + remark-gfm
- Fetch API with SSE streaming
- Custom animated UI components
- Firebase Auth (Google + Email/Password)
- JWT token forwarded to backend on every request
- Collapsible sidebar with chat search
- Streaming token rendering
- Model selector dropdown with tier picker
- File & image upload (drag-and-drop supported)
- Deep Search toggle β visible to all users, active for Premium
- Copy / Retry / Edit / Share per message
- Token counter per conversation
- Chat sharing via public link
- Premium upgrade + cancel flows
- Responsive dark UI
cd apps/web
npm install
npm run devFrontend runs at:
http://localhost:3000
The frontend is NOT containerized. It runs using the Next.js dev server.
The backend handles:
- Firebase ID token verification (Admin SDK)
- Per-user chat session management
- Message persistence scoped to
user_id - Provider routing across 5 providers
- Streaming responses (SSE)
- File-aware and image-aware prompt building
- Deep Search β Tavily web search injected into any model's context (premium-gated)
- Premium billing via Polar webhooks
- Subscription cancel / reactivate endpoints
- Python 3.12
- FastAPI + Uvicorn
- SQLAlchemy (Async) + asyncpg
- PostgreSQL
- firebase-admin (Python SDK)
- OpenAI SDK
- Anthropic SDK
- Google GenAI SDK
- tavily-python
- httpx
- python-dotenv
- Pydantic v2
Deep Search lets users ground any AI model with live web results β regardless of provider.
How it works:
- User toggles Search in the composer (Premium only)
- The user's message is sent to Tavily (
search_depth=advanced) - Search results are formatted and injected into the system prompt
- The selected model (GPT, Claude, Gemini, Grok, etc.) answers using real-time context
- The model cites sources in its response
This works across all providers β not just Anthropic β because the search context is injected at the prompt level, not via a tool call.
Billing is handled by Polar (polar.sh), which supports AI/chatbot products and Israeli payouts via Stripe Connect.
Plans:
- Monthly β $5/month
- Yearly β $3.50/month (billed at $42/year, save 30%)
Premium features:
- All AI models (OpenAI, Claude, Gemini, Grok, DeepSeek, Mistral, Llama)
- Deep Search β real-time web on any model
- File & image uploads
- 8,192 token context window (4Γ free)
- Higher usage limits
Webhook events handled:
subscription.activeβ grant premiumsubscription.canceledβ access continues until period endsubscription.revokedβ revoke premiumsubscription.updatedβ sync status
cd apps/api
docker build -t mlm-backend .
docker run -p 8000:8000 --env-file .env mlm-backendBackend available at http://localhost:8000
NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_web_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_firebase_app_id
NEXT_PUBLIC_API_URL=http://localhost:8000DATABASE_URL=postgresql+asyncpg://user:password@host:5432/dbname
FIREBASE_SERVICE_ACCOUNT_JSON=./secrets/firebase-sa.json
OPENAI_API_KEY=your_key
ANTHROPIC_API_KEY=your_key
GEMINI_API_KEY=your_key
OPENROUTER_API_KEY=your_key
GROQ_API_KEY=your_key
TAVILY_API_KEY=your_key
POLAR_ACCESS_TOKEN=your_key
POLAR_WEBHOOK_SECRET=your_key
POLAR_MONTHLY_PRODUCT_ID=your_product_id
POLAR_YEARLY_PRODUCT_ID=your_product_id
POLAR_ENV=production
FRONTEND_URL=https://multillm.netPostgreSQL with async SQLAlchemy. Tables include:
usersβ Firebase UID, premium status, subscription ID, usage counterschatsβ linked touser_id, model, title, share tokenmessagesβ linked tochat_id, role, content
All queries are filtered by the authenticated user_id.
- Async generators (
yield) per provider - Normalizes OpenAI, Anthropic, Gemini, Groq, OpenRouter streaming APIs
- Flushes to DB progressively during streaming
ReadableStream+ SSE parsing- Appends tokens live to UI
- Handles
status,done,errorevent types
Models use a provider:model_name prefix:
openai:gpt-5
anthropic:claude-sonnet-4-6
gemini:models/gemini-2.5-pro
groq:llama-3.3-70b-versatile
openrouter:x-ai/grok-4.3
openrouter:deepseek/deepseek-chat
The backend parses the provider prefix and initializes the correct SDK client.
- Node 18+
- Python 3.11+ (3.12 recommended)
- Docker (for backend)
- PostgreSQL instance (local or remote)
- Firebase project with Auth enabled
- Polar account (for billing)
- Tavily account (for Deep Search)
Add all NEXT_PUBLIC_* vars to Vercel environment settings.
uvicorn main:app --host 0.0.0.0 --port 8000Inject all .env secrets via platform secret manager.
Built by Eliachar Feig
Senior Mobile & Full-Stack Engineer
iOS Β· Flutter Β· React Β· AI Systems Β· Architecture-first development
π eliacharfeig.com
MIT License
This project demonstrates:
- Firebase Auth with per-user chat isolation
- Multi-provider LLM abstraction
- Streaming architecture
- Full-stack separation
- Production-style backend design
- Modern TypeScript + Python integration
- Clean and scalable AI chat foundation

