T3.chat why is the chat api POST response after a prompt not in JSON?

Hi, I have been using t3.chat frequently - theo and his team's wonderful AI chat interface after seeing the video on it. I spend some time dissecting it and while looking over the network requests, I realized that the response from this endpoint https://t3.chat/api/chat is not in JSON. What it looks like
0:"Hello"
0:"!"
0:" I'm"
0:" doing"
0:" well"
0:","
0:" thank"
0:" you"
0:" for"
0:" asking"
0:"."
0:" How"
0:" about"
0:" you"
0:"?"
0:" How"
0:" can"
0:" I"
0:" assist"
0:" you"
0:" today"
0:"?"
0:"Hello"
0:"!"
0:" I'm"
0:" doing"
0:" well"
0:","
0:" thank"
0:" you"
0:" for"
0:" asking"
0:"."
0:" How"
0:" about"
0:" you"
0:"?"
0:" How"
0:" can"
0:" I"
0:" assist"
0:" you"
0:" today"
0:"?"
What are the pros of doing it in this format over typical JSON ? Is it for assistance in parsing?
1 Reply
mukomo
mukomo5w ago
Don't you only send JSON when the message body is complete? the chat streams the response out without waiting for a completed response to your input

Did you find this page helpful?