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:
π» 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
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.