mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
11 lines
287 B
JavaScript
11 lines
287 B
JavaScript
|
|
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);
|
||
|
|
})();
|