This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import OpenAI from 'openai'; | |
| import 'dotenv/config'; | |
| //Instructions to run: | |
| // 1. npm install openai dotenv | |
| // 2. create .env file with OPENAI_API_KEY=yourkey | |
| // 3. node index.js | |
| const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY }); |