We launched Convex Components to make adding features to your app easier! 🎉

Learn more
Back to Templates

ChatGPT with HTTP Response Streaming

Built with

Tags

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
Get your app up and running in minutes
Get started
Convex logo
A Trusted Solution
  • SOC 2 Type 1 Compliant
  • HIPAA Compliant
  • GDPR Verified
©2024 Convex, Inc.