A modern web application that allows you to chat with multiple large language models simultaneously and compare their responses in real-time.
✨ View Live Demo ✨
- Concurrent Model Queries: Chat with up to 5 different AI models at the same time.
- Real-time UI Updates: See responses from each model appear individually as soon as they are available.
- Local Model Support: Connect to locally hosted models (e.g., via Ollama) and compare them against cloud-based APIs.
- Remote API Integration: Natively supports any OpenAI-compatible endpoint, with OpenRouter configured out of the box.
- Markdown Rendering: Displays responses with rich text formatting and syntax highlighting for code.
- Persistent Settings: Your API keys and model configurations are saved locally in your browser.
- Responsive Design: A clean, modern UI that works seamlessly on desktop and mobile devices.
This application can connect to a wide variety of models through services like OpenRouter or by connecting to your own local servers. The default configuration includes:
- GPT-4.1 Mini (OpenAI)
- Claude 3 Haiku (Anthropic)
- Mistral Codestral 2508 (Mistral AI)
- And any local model you configure!
- Frontend: React 18 + TypeScript + Vite
- Styling: Tailwind CSS
- State Management: React Hooks
- Markdown:
react-markdownwithrehype-highlight - Icons: Lucide React
- Node.js v18 or later
- NPM, Yarn, or PNPM
-
Clone the repository:
git clone https://github.com/seehiong/multi-model-chat.git cd multi-model-chat -
Install dependencies:
npm install
-
Start the development server:
npm run dev
Your application should now be running on
http://localhost:3000(or another port if 3000 is in use).
- Open the application in your browser.
- To query remote models, you will need an API key from a service like OpenRouter.ai.
- Navigate to the Settings page in the application and paste your API key into the "OpenRouter API Key" field. The key is saved to your browser's
localStorage. - Important Security Note: For maximum security, it is recommended to create temporary keys on your provider's dashboard (like OpenRouter) for your sessions and delete them when you are finished.
- On the settings page, you can also configure any Local Models you are running (e.g., via Ollama).
- Return to the main page, select the models you want to chat with, and start your conversation!
This application is fully client-side and serverless. All API requests go directly from your browser to the endpoints (e.g., OpenRouter or local servers), with settings and API keys stored securely in your browser's local storage.
You can build the entire application into a single, self-contained HTML file that can be opened by double-clicking from your file manager, emailed, or stored offline:
npm run build:singleThis compiles all React components, styling, logic, and assets into a single file at dist/index.html.
- How to run: Double-click
dist/index.htmlto open it directly via thefile://protocol in any browser.
To deploy to any standard static file host (e.g., Netlify, Cloudflare Pages, or a local static server like serve or Live Server):
npm run buildThis compiles the app with relative paths (base: './') in the dist/ directory. Simply upload or serve the contents of the dist/ directory.
A GitHub Actions workflow is configured in .github/workflows/deploy.yml to automatically build and host the application on GitHub Pages whenever you push to the main branch.
To set it up:
- Push the code to your GitHub repository.
- In your repository on GitHub, navigate to Settings > Pages.
- Under Build and deployment > Source, select GitHub Actions.
- Push a commit or trigger the workflow manually under the Actions tab on GitHub, and your app will be hosted automatically.
When querying local models (like Ollama running on http://127.0.0.1:11434) directly from the browser (either via file:// or a local web page), the browser's security model (CORS) may block the requests.
To allow connection:
- On Windows:
- Close Ollama from the taskbar tray.
- Open PowerShell or Command Prompt.
- Run:
setx OLLAMA_ORIGINS "*"(or$env:OLLAMA_ORIGINS="*"for the current session). - Start Ollama.
- On macOS/Linux:
Launch Ollama with the environment variable set:
OLLAMA_ORIGINS="*" ollama serve
.
├── public/ # Static assets
├── src/
│ ├── components/ # React components
│ ├── config/ # Model configurations
│ ├── hooks/ # Custom React hooks (useChat)
│ ├── services/ # API and Settings services
│ ├── types/ # TypeScript definitions
│ ├── App.tsx # Main application component
│ └── main.tsx # Application entry point
└── package.json
Contributions are welcome! If you have a feature request, bug report, or want to improve the code, please feel free to:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name). - Make your changes.
- Commit your changes (
git commit -m 'Add some amazing feature'). - Push to the branch (
git push origin feature/your-feature-name). - Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
