The async iterator
The TypeScript SDK exposes streaming as client.messages.stream(...) returning an async iterator of typed events plus a finalMessage() promise. Iterate with for await; await finalMessage for usage. Same shape as Python, just typed.
Next.js Route Handlers and ReadableStream
Next.js App Router Route Handlers can return a Response with a ReadableStream body. Pipe the SDK's text stream into the Response stream and the browser sees tokens as they arrive. The same shape works on Vercel Edge.
Backpressure and cancellation
If the client disconnects mid-stream, you want to stop generating to save tokens. Wire the request's AbortSignal to the SDK call so server-side generation halts when the browser tab closes. Every SDK method takes signal in its request options, the second argument; a signal placed in the request body cancels nothing.