import OpenAI from 'openai';
const DEFAULT_MODEL = 'gpt-4o';
export async function runWithOpenAI(prompt, model = DEFAULT_MODEL) {
    if (!process.env.OPENAI_API_KEY) {
        throw new Error('OPENAI_API_KEY is not set. Add it to your .env file.');
    }
    const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
    const response = await client.chat.completions.create({
        model,
        messages: [{ role: 'user', content: prompt }],
    });
    return response.choices[0]?.message?.content ?? '';
}
