A lightweight terminal-based chatbot built with Node.js that connects to the OpenAI API to generate conversational responses in real time.
Built as a hands-on introduction to the OpenAI API and working with environment-based API key configuration in Node.js.
Run the app from the terminal, type a message, and receive a response generated by OpenAI's GPT model. Each message is treated independently — the chatbot does not retain memory across turns.
- Runtime: Node.js
- API: OpenAI Chat Completions API
- Config: dotenv for API key management
- Clone the repo
git clone https://github.com/devvyas909/ChatGPT-Chatbot.git
cd ChatGPT-Chatbot- Install dependencies
npm install- Create a
.envfile in the root directory OPEN_AI_KEY="your-openai-api-key-here" - Run the chatbot
node index.js- Make sure your
.envfile is listed in.gitignoreand never committed - Requires a valid OpenAI API key from platform.openai.com