A simple ChatGPT clone built with Next.js and the OpenRouter API.
This project is a basic implementation of a ChatGPT-like web application. It allows users to send messages to an AI model and receive responses. It uses the OpenRouter API with the google/gemini-2.0-flash-exp:free
model.
- Chat interface with user and bot messages
- Loading indicator while waiting for a response
- Styled with Tailwind CSS
- Uses Inter font from Google Fonts
- Node.js and npm installed
- An OpenRouter API key
- Clone the repository:
git clone [repository URL]
- Navigate to the project directory:
cd takon
- Install dependencies:
npm install
- Set the environment variable:
Create a .env.local
file in the root directory and add your OpenRouter API key:
OPENROUTER_API_KEY=your_openrouter_api_key
- Run the application:
npm run dev
- Open your browser and go to
http://localhost:3000
.
- Create a Vercel account: If you don't have one already, sign up for a Vercel account at https://vercel.com/.
- Install the Vercel CLI:
npm install -g vercel
- Create
vercel.json
: Create avercel.json
file in the root of your project with the following content:
{
"version": 2,
"builds": [
{
"src": "next.config.js",
"use": "@vercel/next"
}
],
"routes": [
{
"src": "/api/(.*)",
"dest": "/api/$1"
}
],
"env": {
"OPENROUTER_API_KEY": "@openrouter_api_key"
}
}
- Deploy the app:
vercel
- Set the environment variable: Vercel will ask you about setting environment variables. Set the
OPENROUTER_API_KEY
environment variable to your OpenRouter API key. - Wait for the deployment: Vercel will build and deploy your app. Once the deployment is complete, you'll get a URL where you can access your live app.