chat/completions streams SSE when the stream field is omitted (OpenAI default is stream:false)
Summary
When a client calls POST /v1/chat/completions without the stream field, 9router responds with SSE streaming (content-type: text/event-stream, chat.completion.chunk frames).
Per the OpenAI API spec, stream defaults to false: a request without the field must get a single JSON chat.completion object. Every OpenAI-compatible client that omits stream and calls response.json() on the body breaks against 9router — and typically breaks silently, because the fetch itself succeeds (HTTP 200) and only the JSON parse fails downstream.
Repro (v. current as of 2026-09-17, self-hosted Docker)
# stream omitted → SSE (unexpected)
curl -s -X POST http://HOST:20128/v1/chat/completions \
-H "Authorization: Bearer sk-..." -H "Content-Type: application/json" \
-d '{"model":"claude-haiku-4-5-20251001","messages":[{"role":"user","content":"hi"}],"max_tokens":20}' \
-D- -o /dev/null | grep -i content-type
# → content-type: text/event-stream
# stream:false explicit → JSON (correct)
# same request with "stream": false
# → content-type: application/json, single chat.completion object"stream": false is honored correctly — the bug is only the default when the field is absent.
Impact
Real-world example that led me here: Budgero's AI Assistant (an OpenAI-compatible integration) omits stream and does response.json() — its auto-categorization feature failed silently (fallback to zero results) until I put a proxy in front of 9router that injects stream: false when absent. Any SDK or hand-rolled client that treats the OpenAI default as authoritative will hit the same wall.
Expected
A request without stream returns a non-streamed chat.completion JSON body, matching the OpenAI default. (Related but distinct from #3682, which is about a forced-streaming provider returning a non-streamed body on retry — this one is about the top-level default for clients that never asked for streaming.)
Thanks for 9router — happy to test a fix on my instance.
Source: decolua/9router