☰ Core / Streaming
Docs / Core
Streaming
stream(projectKey, endpoint, params?, opts?) returns an AsyncIterable<StreamEvent> for SSE and chunked endpoints. text/event-stream responses yield SseEvent objects ({ event?, data, id? }); any other body yields raw text chunks.
stream.ts
for await (const event of client.stream("ai:chat", "completions", { prompt: "hi",})) { // SSE responses yield { event?, data, id? }; other bodies yield raw text console.log(typeof event === "string" ? event : event.data);}for await (const event of client.stream("ai:chat", "completions", { prompt: "hi",})) { // SSE responses yield { event?, data, id? }; other bodies yield raw text console.log(typeof event === "string" ? event : event.data);}Edit this page on GitHubWas this page helpful? ·
Docs menu