DEV Community

Cover image for How to create an AI powered chatbot using NextJS & OpenAI API ?
Yacine Messaadi
Yacine Messaadi

Posted on • Originally published at yacine-messaadi.com

How to create an AI powered chatbot using NextJS & OpenAI API ?

Building an application that allows you and your users to discuss with an artificial intelligence has never been easier !

Through this very short tutorial, you will have your own AI powered website like this:

Screenshot of the app

Get your OpenAI API key

Assuming you have the beta access to OpenAI, visit this page to get your key. It will be useful for the next part.

Setting up the project

Get the template

Source code here : Github Repo (OpenSource).

Clone the repo and go to the .env.example file to put your OpenAI API key.

Then, rename the file by removing the .example part.

Try it out !

Start your server by writing the command below and open your browser to localhost .

npm install
npm run dev
Enter fullscreen mode Exit fullscreen mode

The end

Thanks for reading this article, share it and follow me if you found it interesting !
If you have any question, feel free to contact me or comment the post.
Visit my blog !

Top comments (0)