A modern ChatGPT-style interface powered by Google's Gemini models and open-source models from OpenRouter, built with Next.js, TypeScript, and tRPC.
- 🤖 Multiple AI Models: Support for Gemini models (2.5 Pro, 2.5 Flash, 2.0 Flash) and open-source models from OpenRouter
- 🌟 Open-Source Models: Access to popular open-source models like Mistral, Llama, Qwen, Phi-3, Gemma, and DeepSeek
- 💬 ChatGPT-like UI: Beautiful, responsive interface with dark mode support
- ⚡ Streaming Responses: Real-time streaming of AI responses for a smooth experience
- 🎨 Modern Design: Clean, minimalist design inspired by ChatGPT
- 🔒 Type-Safe: Built with TypeScript and tRPC for end-to-end type safety
- Node.js 18+ and npm/yarn/pnpm
- A Google Gemini API key (Get one here)
- (Optional) An OpenRouter API key for open-source models (Get one here)
- (Optional) A Perplexity API key for web search models (Get one here)
-
Clone and install dependencies:
npm install # or yarn install # or pnpm install
-
Set up environment variables:
cp .env.example .env
Then edit
.envand add your API keys:GEMINI_API_KEY=your_gemini_api_key_here OPENROUTER_API_KEY=your_openrouter_api_key_here PERPLEXITY_API_KEY=your_perplexity_api_key_hereNote: You need at least one API key. Gemini API key is required for Gemini models, OpenRouter API key is required for open-source models, and Perplexity API key is required for Perplexity models.
-
Run the development server:
npm run dev # or yarn dev # or pnpm dev
-
Open your browser: Navigate to http://localhost:3000
├── app/ # Next.js app directory
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Main chat page
│ ├── providers.tsx # tRPC and React Query providers
│ └── globals.css # Global styles
├── components/ # React components
│ ├── ChatMessage.tsx # Message bubble component
│ ├── ChatInput.tsx # Input component
│ └── ModelSelector.tsx # Model selection dropdown
├── pages/
│ └── api/ # API routes
│ ├── trpc/ # tRPC endpoint
│ └── chat/ # Unified chat streaming endpoint
├── server/ # Backend server code
│ ├── trpc.ts # tRPC setup
│ ├── models.ts # Unified model configuration
│ ├── services/ # API service clients
│ │ └── openrouter.ts # OpenRouter client
│ └── routers/ # tRPC routers
│ ├── gemini.ts # Gemini API router
│ └── _app.ts # Main app router
├── types/ # TypeScript types
└── utils/ # Utility functions
└── trpc.ts # tRPC client setup
- Gemini 2.5 Pro: Advanced model with higher performance for complex tasks
- Gemini 2.5 Flash: Optimized for speed and cost-efficiency
- Gemini 2.0 Flash: Earlier version with foundational features
- Mistral 7B Instruct: Fast and efficient 7B parameter model
- Llama 3.2 3B Instruct: Lightweight and fast 3B parameter model
- Llama 3.2 1B Instruct: Ultra-lightweight 1B parameter model
- Sonar: Perplexity Sonar model with web search and citations
- Sonar Pro: Most capable Perplexity model with web search and citations
- Select a model from the dropdown at the top
- Type your message in the input box
- Press Enter to send (Shift+Enter for new line)
- Watch as the AI streams its response in real-time
- Framework: Next.js 14
- Language: TypeScript
- API: tRPC
- Styling: Tailwind CSS
- AI: Google Gemini API, OpenRouter API, Perplexity API
- State Management: React Query
MIT