import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'YOUR_EASY_PEASY_API_KEY',
baseURL: 'https://easy-peasy.ai/api',
});
// Non-streaming
const response = await client.chat.completions.create({
model: 'gemini-3-flash',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Hello!' },
],
});
console.log(response.choices[0].message.content);
// Streaming
const stream = await client.chat.completions.create({
model: 'gemini-3-flash',
messages: [{ role: 'user', content: 'Tell me a story.' }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}