automuse/index.ts
Xe Iaso 21132b33d4 initial code commit
Signed-off-by: Xe Iaso <me@xeiaso.net>
2023-04-12 09:08:06 -04:00

16 lines
424 B
TypeScript

import * as dotenv from "dotenv";
import { Configuration, OpenAIApi } from "openai";
dotenv.config();
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const completion = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [{ role: "user", content: "Hello world" }],
});
console.log(completion.data.choices[0].message);