Multi-AI Chat Application with Vercel AI Gateway - Connect with multiple AI models (GPT-4, Claude, Gemini, etc.) through a single interface.
- 🤖 Multi-Model Support: Access 17+ AI models from OpenAI, Anthropic, Google, Meta, and more
- 💰 Cost Tracking: Real-time usage and cost monitoring per model
- 🔄 Model Switching: Seamlessly switch between different AI models
- 🎨 Modern UI: Clean, responsive interface built with Next.js and Tailwind CSS
- 🔐 Secure: API keys managed through Vercel environment variables
- ⚡ Fast: Optimized for performance with Vercel Edge Functions
- 📊 Usage Analytics: Track your AI usage and spending
- Node.js 18+
- npm or yarn
- Vercel account (for deployment)
- API Gateway key from Vercel
- Clone the repository
git clone https://github.com/aaprosperi/braincolab.git
cd braincolab- Install dependencies
npm install
# or
yarn install- Set up environment variables
Create a .env.local file:
AI_GATEWAY_API_KEY=your_vercel_ai_gateway_key_here- Run development server
npm run dev
# or
yarn devOpen http://localhost:3000 in your browser.
- Push your code to GitHub
- Import project in Vercel
- Add environment variable:
AI_GATEWAY_API_KEY - Deploy!
The app auto-deploys on push to the main branch.
npm run build
npm start| Provider | Models | Pricing |
|---|---|---|
| OpenAI | GPT-3.5, GPT-4, GPT-4o | $0.0005 - $0.06/1K tokens |
| Anthropic | Claude Haiku, Sonnet, Opus | $0.00025 - $0.075/1K tokens |
| Gemini Flash, Pro, 2.0 | $0 - $0.005/1K tokens | |
| Meta | Llama 3.3 70B | $0.00018/1K tokens |
| Others | Mistral, Grok, DeepSeek, Perplexity | Various |
| Variable | Description | Required |
|---|---|---|
AI_GATEWAY_API_KEY |
Vercel AI Gateway API key | Yes |
NEXT_PUBLIC_APP_URL |
Your app URL (for production) | No |
braincolab/
├── pages/
│ ├── api/ # API routes
│ │ ├── chat.js # Main chat endpoint
│ │ └── credits.js # Credits tracking
│ ├── _app.js # App wrapper
│ ├── index.js # Landing page
│ └── multiAI.js # Multi-AI chat interface
├── styles/
│ └── globals.css # Global styles
├── public/ # Static assets
├── package.json # Dependencies
└── vercel.json # Vercel configuration
- Method: POST
- Body:
{ messages, model } - Response: AI model response with usage data
- Method: GET
- Response: Current credit balance
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Vercel for hosting and AI Gateway
- Next.js for the framework
- Tailwind CSS for styling
- All AI model providers
For support, email aaprosperi@gmail.com or open an issue on GitHub.
Built with ❤️ by Brain Co-Lab Team