UNPKG

node-ai-chatbot-cli

Version:

A lightweight Node.js package and CLI tool that allows developers to easily interact with OpenAI's ChatGPT API. Supports automated API key setup, simple chatbot creation, and seamless integration into JavaScript applications. Ideal for building AI-powered

16 lines (12 loc) • 461 B
#!/usr/bin/env node const fs = require('fs'); const path = require('path'); const prompt = require('prompt-sync')(); console.log("\nšŸ”§ ChatGPT Chatbot Setup"); const apiKey = prompt("Enter your OpenAI API Key: "); if (!apiKey) { console.error("āŒ API Key is required!"); process.exit(1); } fs.writeFileSync(path.join(__dirname, '.env'), `OPENAI_API_KEY=${apiKey}\n`); console.log("āœ… API Key saved! You can now use the chatbot.");