Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 409 Bytes

openai_o1.md

File metadata and controls

21 lines (17 loc) · 409 Bytes

<openai_docs> Node.js:

import OpenAI from "openai"; const openai = new OpenAI();

const completion = await openai.chat.completions.create({ model: "o1-preview", messages: [ { role: "user", content: "Prompt" } ] });

console.log(completion.choices[0].message.content);

Ensure you have your OpenAI API key in the .env file Example: OPENAI_API_KEY=your_api_key_here </openai_docs>