[Feature] Streaming #10
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
LLMAPI currently buffers every upstream response server-side and returns a single JSON payload once inference completes. For API consumers — which is how our own employees use this service — this creates two concrete issues:
Current state
/v1/chat/completionsacceptsstream: trueand proxies SSE correctly./v1/responses(OpenAI Responses API) does not stream — it always buffers.RESPONSE_CACHE) only stores non-streaming responses, so there is no architectural reason to keep buffering as the default.PROVIDER_STREAM_STALL_TIMEOUT_MSalready exists to guard against stalled streams.Proposal
Make streaming the default inference mode across all surfaces. Non-streaming becomes an explicit opt-out.
Default behavior
stream: trueorAccept: text/event-streamstream: falsestreamomittedSurfaces affected
/v1/chat/completions/v1/responses/v1beta/chat/completions/mcp/api/chatOpt-out
Clients that need a single JSON payload (batch jobs, webhook consumers, legacy integrations) send
stream: falseexplicitly. No breaking change for them — they already set it.Response cache interaction
The existing response cache already excludes streaming responses. No change needed there. If a future "streaming cache" is desired, it can be layered on later.
Backwards compatibility
stream: false→ unchanged.stream: true→ unchanged.stream→ behavior changes from buffer to stream. This is the intended migration. ASunset-style warning header on the first N responses can smooth the transition.Why this matters for us
Our employees consume LLMAPI exclusively through the API. They need streaming to:
This is an API feature, not a UX feature — the dashboard is unaffected.
Related
RESPONSE_CACHE) — already streaming-aware.PROVIDER_STREAM_STALL_TIMEOUT_MS— already guards mid-stream stalls.FALLBACK_TIME_BUDGET_MS— failover budget applies per-chunk, not per-request.