diff --git a/app/chatgpt.js b/app/chatgpt.js new file mode 100644 index 000000000..8e1dbcf45 --- /dev/null +++ b/app/chatgpt.js @@ -0,0 +1,10 @@ +require('dotenv').config(); +(async () => { + const { ChatGPTAPI } = await import('chatgpt'); + + const api = new ChatGPTAPI({ apiKey: process.env.OPENAI_KEY }); + + // send a message and wait for the response + let res = await api.sendMessage('What is OpenAI?'); + console.log(res); +})();