A simple chat app built with Next.js 13 App Router, Tailwind CSS, and OpenAI API.
- Clone the repo:
git clone https://github.com/komzweb/chatgpt-nextjs-app-router.git
- Add your OpenAI API key:
cd chatgpt-nextjs-app-router
cp .env.local.example .env.local
Set your secret API key to OPENAI_API_KEY
in the .env.local
file.
- Install dependencies:
npm install
# or
yarn
# or
pnpm
- Run the server:
npm run dev
# or
yarn dev
# or
pnpm dev
Open http://localhost:3000 with your browser to see the result.
app/api/openai/route.ts
- If you belong to multiple organizations, you can specify your organization ID. See the API Reference for details.
- You can change the system message and set the behavior of your assistant. By default, the assistant is instructed to be "You are a helpful assistant who speaks Japanese Kansai dialect."
Almost same as ChatGPT!