How is your experience with the OutSystems Community?
22
Views
2
Comments
How to use openai output by streaming?
Question

Hi There,

I create one reactive web app , it will invoke the openai by use stream=true. It will out AI result by streaming .  How can I get it ?

Many Thanks,

Jack

2026-03-20 01-28-51
Saugat Biswas

Hi @Jack Bao,

You cannot consume stream=true OpenAI responses directly via a standard OutSystems REST integration and get partial tokens. OutSystems REST consumers buffer the full HTTP response, so streamed SSE chunks are not exposed incrementally to the Reactive UI.

To actually get streaming output in the UI, you must use Server‑Sent Events (SSE) or WebSockets, with a server-side proxy.

Solution:

Step 1: Create a server-side proxy

This proxy can be: 

  • Node.js 
  • .NET 
  • Azure Function 
  • AWS Lambda 

What the proxy does 

  • Receives request from OutSystems UI 
  • Calls OpenAI with stream=true 
  • Forwards each SSE chunk as-is to the client

Step 2: SSE Reactive Client (Forge)

This Forge component is built specifically for this:

  • Fully supports SSE in Reactive Web Apps
  • Wraps browser EventSource
  • No custom JS required
  • ODC compatible

Step 3: Update the UI incrementally 

For each SSE message: 

  • Append text to a screen variable 
  • Re-render the chat/message component 
  • Achieve the “typing” effect

Hope this helps,

Cheers,

Saugat

2025-07-22 10-30-27
Mandar Deshpande

One thing worth noting is why stream=true doesn't work through a standard consumed REST API. 

OpenAI returns Server-Sent Events incrementally, but OutSystems REST integrations buffer the response and only return control when the request completes. 

Because of that, the Reactive UI never receives the intermediate chunks. That's why a streaming-capable proxy (SSE or WebSocket) is required between OpenAI and the browser. Also, keep the OpenAI API key in the proxy layer rather than exposing it to the client.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.