Generation options (same shape as generateText).
A StreamTextResult with async iterables and awaitable promises.
const { textStream } = streamText({ provider: 'openai', model: 'gpt-4o', prompt: 'Tell me a joke.' });
for await (const chunk of textStream) {
process.stdout.write(chunk);
}
Stateless streaming text generation with optional multi-step tool calling.
Returns a StreamTextResult immediately; the underlying provider call begins when a consumer starts iterating
textStreamorfullStream, andtext,usage,toolCallsand the other promises settle once that iteration has run the stream to its end or the consumer stopped reading. Awaiting a promise alone starts no request and never settles it: a caller that wants only the assembled text calls generateText, or reads the stream to its end first.