API reference
Streaming
Show the reply as it is written.
Set stream to true. EON sends chat.completion.chunk events, each with a delta, and ends with data: [DONE].
const stream = await eon.chat.completions.create({
model: 'eon',
stream: true,
messages: [{ role: 'user', content: 'Explain black holes simply.' }],
})
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? '')
}