Skip to content

AI GPT-3 Chatbot Example

Simple chat bot implemented with Next.js, API Routes, and OpenAI SDK (GPT-3).

Framework
Use Case
Publisher ▲ Vercel

AI Chat GPT-3 example

This example shows how to implement a simple chat bot using Next.js, API Routes, and OpenAI API.

Components

  • Next.js
  • OpenAI API (REST endpoint)
  • API Routes (Edge runtime)

How to Use

You can choose from one of the following two methods to use this repository:

One-Click Deploy

Deploy the example using Vercel:

Clone and Deploy

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example https://github.com/vercel/examples/tree/main/solutions/ai-chatgpt
# or
yarn create next-app --example https://github.com/vercel/examples/tree/main/solutions/ai-chatgpt
Set up environment variables

Rename .env.example to .env.local:

cp .env.example .env.local

then, update OPENAI_API_KEY with your OpenAI secret key.

Next, run Next.js in development mode:

npm install
npm run dev

# or

yarn
yarn dev

The app should be up and running at http://localhost:3000.

Deploy it to the cloud with Vercel (Documentation).

AI GPT-3 Chatbot Example

Simple chat bot implemented with Next.js, API Routes, and OpenAI SDK (GPT-3).

Framework
Use Case
Publisher ▲ Vercel

AI Chat GPT-3 example

This example shows how to implement a simple chat bot using Next.js, API Routes, and OpenAI API.

Components

  • Next.js
  • OpenAI API (REST endpoint)
  • API Routes (Edge runtime)

How to Use

You can choose from one of the following two methods to use this repository:

One-Click Deploy

Deploy the example using Vercel:

Clone and Deploy

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example https://github.com/vercel/examples/tree/main/solutions/ai-chatgpt
# or
yarn create next-app --example https://github.com/vercel/examples/tree/main/solutions/ai-chatgpt
Set up environment variables

Rename .env.example to .env.local:

cp .env.example .env.local

then, update OPENAI_API_KEY with your OpenAI secret key.

Next, run Next.js in development mode:

npm install
npm run dev

# or

yarn
yarn dev

The app should be up and running at http://localhost:3000.

Deploy it to the cloud with Vercel (Documentation).

Unleash New Possibilities

Deploy your app on Vercel and unlock its full potential

Try Vercel Free