Stream responses in next js without open ai package

I’m eager to delve into the world of streaming responses from ChatGPT without relying on the OpenAI package. Could you share insights or tips on achieving this using alternative methods?

Any update to this thread that you started 3 months ago?

In general it as easy as adding “stream: true” to the body that you send to rhe API, but what comes back is a pretty ugly format – string chunks that are JSON, but in Node you might find some of them are incomplete so can’t be JSON.parse’d each.

Also you should include “signal” property in the fetch() options so you can AbortController.abort() – see MDN for that, some great examples.

GL!