Skip to content

Streaming

Streaming follows the OpenAI-compatible chat completions pattern. Set stream: true and consume the response as Server-Sent Events.

{
"model": "deepseek-chat",
"stream": true,
"messages": [
  { "role": "user", "content": "Write a tiny launch checklist." }
]
}
Node streaming with stream: true
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "sk-xxx",
  baseURL: "https://api.glideflowai.com/v1",
});

const stream = await client.chat.completions.create({
  model: "deepseek-chat",
  stream: true,
  messages: [{ role: "user", content: "Write a tiny launch checklist." }],
});

for await (const event of stream) {
  process.stdout.write(event.choices[0]?.delta?.content ?? "");
}

When streaming over raw HTTP, read each SSE data: event until the upstream provider finishes the completion.