All templates

ChatGPT with HTTP Response Streaming


Built with:

npm create convex -- -t sshader/streaming-chat-gpt

An example of streaming ChatGPT via the OpenAI v4.0 node SDK, similar to this template.

However this app uses an HTTP endpoint with response streaming to send the ChatGPT response to the message author without having to update the database on every streamed part, which is covered by this Stack post.

The result is that the author of a message sees frequent updates to their message, while any other viewers receive batched updates, and the app overall requires less database bandwidth.

This app makes up a name for your user using Faker.js and allows you to chat with other users: open up multiple tabs to try it out!

If your message includes "@gpt" it will kick off a request to OpenAI's chat completion API and stream the response, updating the message as data comes back from OpenAI.

Template hero image

Start now

Get your project up and running in minutesGet started
©2024 Convex, Inc.