[PR #613] fix: default stream to false in /v1/chat/completions per OpenAI spec #488

Open
opened 2026-10-18 21:06:34 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/pipelines/pull/613
Author: @xanyl
Created: 10/15/2026
Status: 🔄 Open

Base: main ← Head: fix/chat-completions-stream-default


📝 Commits (1)

  • 020a050 fix: default stream to false in OpenAIChatCompletionForm

📊 Changes

1 file changed (+9 additions, -2 deletions)

View changed files

📝 schemas.py (+9 -2)

📄 Description

Fixes #612

Summary

OpenAIChatCompletionForm.stream defaulted to True, so POST /v1/chat/completions returned SSE streaming responses even when the request omitted stream. The OpenAI Chat Completions API defines stream as optional with a default of false; clients such as LiteLLM's openai/ provider omit the key on non-streaming calls and then fail to parse the unexpected SSE body (OpenAIException - Empty or invalid response).

Changes

  • schemas.py: stream: bool = True → stream: bool = False

Safety

OpenAIChatCompletionForm is only constructed by FastAPI from request bodies, and form_data.model_dump() always includes stream, so every downstream read (body["stream"] in the OpenAI/Ollama/manifold example pipelines, body.get("stream", …) in the Perplexity one) keeps working — only the omitted-key default changes.

Backwards compatibility

Clients that omit stream while relying on the previous streaming default will now receive JSON instead of SSE. That is the spec-compliant behavior; the old default was the bug.

Verification

Manual, per the issue's reproduction (repo has no test suite):

  • stream omitted → content-type: application/json
  • stream: false → JSON
  • stream: true → text/event-stream SSE

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/pipelines/pull/613 **Author:** [@xanyl](https://github.com/xanyl) **Created:** 10/15/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/chat-completions-stream-default` --- ### 📝 Commits (1) - [`020a050`](https://github.com/open-webui/pipelines/commit/020a05012a6c9b736544c2aeb4b094b9dd604513) fix: default stream to false in OpenAIChatCompletionForm ### 📊 Changes **1 file changed** (+9 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `schemas.py` (+9 -2) </details> ### 📄 Description Fixes #612 ## Summary `OpenAIChatCompletionForm.stream` defaulted to `True`, so `POST /v1/chat/completions` returned SSE streaming responses even when the request omitted `stream`. The OpenAI Chat Completions API defines `stream` as optional with a default of `false`; clients such as LiteLLM's `openai/` provider omit the key on non-streaming calls and then fail to parse the unexpected SSE body (`OpenAIException - Empty or invalid response`). ## Changes - `schemas.py`: `stream: bool = True` → `stream: bool = False` ## Safety `OpenAIChatCompletionForm` is only constructed by FastAPI from request bodies, and `form_data.model_dump()` always includes `stream`, so every downstream read (`body["stream"]` in the OpenAI/Ollama/manifold example pipelines, `body.get("stream", …)` in the Perplexity one) keeps working — only the omitted-key default changes. ## Backwards compatibility Clients that omit `stream` while relying on the previous streaming default will now receive JSON instead of SSE. That is the spec-compliant behavior; the old default was the bug. ## Verification Manual, per the issue's reproduction (repo has no test suite): - `stream` omitted → `content-type: application/json` - `stream: false` → JSON - `stream: true` → `text/event-stream` SSE --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/pipelines#488
No description provided.