supastarter for Next.jsAPI
Streaming responses
Learn how to stream responses from your API.
As supastarter integrates Hono as the API framework, you can easily stream responses from the API which is useful if you are working with AI providers.
Streaming with the API
With Vercel AI SDK
When using the Vercel AI SDK, you can use the streamText
function to call the AI provider and then call the toDataStreamResponse
function to stream the response:
With Hono streamText
If you want to stream any data from your API, you can use the stream
function from Hono.
To learn more about streaming with Hono, you can read the Hono documentation.