DEV Community

Cover image for How to Integrate ChatGPT API in a Node.js App (With GitHub & 8-Minute Video)
mgz coding
mgz coding

Posted on • Originally published at youtube.com

How to Integrate ChatGPT API in a Node.js App (With GitHub & 8-Minute Video)

If you're curious about how to use OpenAI's ChatGPT API in a Node.js application, I built a simple project to demonstrate exactly that β€” and made a short tutorial video to go with it.


πŸ“½οΈ Watch the 8-Minute Video Tutorial:

Watch on YouTube


πŸ’» GitHub Repo:

πŸ‘‰ https://github.com/abbas-mgz/chatgpt-js


βš™οΈ What You'll Learn:

  • How to connect to OpenAI's ChatGPT API
  • How to send and receive prompts using fetch()
  • Basic .env setup for secure API keys
  • Configurable model (GPT-3.5 or GPT-4)
  • Clean and minimal Node.js code (no frontend)

πŸš€ How to Run:


bash
git clone https://github.com/abbas-mgz/chatgpt-js
cd chatgpt-js
npm install
echo "OPENAI_API_KEY=your_key_here" > .env
node index.js



Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.