Skip to content

Build with the API

Build a streaming chatbot

A chat interface that shows the answer as it is written, on the Upfyn API.

A chatbot feels fast when the reply appears word by word instead of all at once. The Upfyn API streams responses so your interface can render each piece as it arrives.

What you need

The shape of it

Keep the conversation

Send the running list of messages with every request so the model has the context.

Ask for a stream

Turn streaming on and read the response as a sequence of small chunks.

Render as you go

Append each chunk to the message on screen, and mark the message complete when the stream ends.

The complete recipe, with code, is on upfyn.com: A streaming chatbot.