EventBlock format.
POST /api/v1/stream (SSE)
Server-Sent Events streaming. The request body is identical to/api/v1/generate.
Headers
Same as/generate, plus:
| Header | Value | Description |
|---|---|---|
Accept | text/event-stream | Required for SSE |
Event Stream Format
block— Incremental content block (text delta, tool call, thinking)done— CompleteInferenceResponsewith token counts and costerror— Error event with classification
Preflight Validation
Before streaming begins, Ensemble performs preflight checks:- API key validation
- Rate limit check
- Parameter validation
- Provider health check
Stall Detection
During streaming, dual timeouts protect against stuck connections:- Inter-token timeout: Detects stalled streams (no data for N seconds)
- Total timeout: Per-model maximum (10-30 minutes for reasoning models like o1, o3, GPT-5)