Skip to main content
This example demonstrates how to implement true Server-Sent Events (SSE) streaming using the OpenAI-compatible /v1/chat/completions endpoint. Unlike simulated streaming, this delivers tokens to the client as they are generated.
The streaming endpoint follows the OpenAI API specification, making it compatible with existing OpenAI client libraries and tools.
Stay on main. There is no example/chat branch, and tags like example/chat-v3.2.0 are a retired Next.js chatbot that will not match these docs. The current chat example is this SSE endpoint — there is no separate frontend resource.

Why SSE Streaming?

  • Real-time delivery - Tokens stream to the client as they’re generated
  • Reduced perceived latency - Users see responses immediately, not after full generation
  • Native browser support - SSE works out of the box with EventSource API
  • OpenAI compatibility - Drop-in replacement for OpenAI streaming endpoints

How It Works

The streaming architecture connects your workflow directly to the HTTP response:

The Streaming Endpoint

The endpoint accepts OpenAI-compatible chat completion requests and returns an SSE stream:
The endpoint is mounted under the /v1 prefix by app/launchpad/api/router.py, so the full path is POST /v1/chat/completions.

Example Workflow

The ExampleStreamingWorkflow (registered as WorkflowRegistry.STREAMING) demonstrates a two-node streaming pipeline:

Streaming Node Examples

Text Streaming

Stream plain text responses token by token:

Structured Streaming

Stream structured Pydantic model outputs:

Run it

This example ships on main under app/launchpad/workflows/examples/streaming/. After installation:

Testing the Endpoint

Use curl to test the streaming endpoint:
You’ll see SSE events streaming in real-time:

Key Features

  • Delta extraction - Only sends new tokens, not the full accumulated text
  • Debouncing - Configurable delay (default 10ms) to batch rapid updates
  • OpenAI chunk format - Compatible with standard OpenAI client libraries
  • Multi-node streaming - Chain multiple streaming nodes in a single workflow
  • Langfuse tracing - Full observability with enable_tracing=True