ed568c4 fix: respect API stream parameter over model settings
📊 Changes
1 file changed (+2 additions, -1 deletions)
View changed files
📝backend/open_webui/main.py (+2 -1)
📄 Description
Description
This PR fixes a regression introduced by commit f138be9 (issue #19154) where the stream parameter sent in API requests is always overridden by the model's stream_response setting.
Problem
While #19154 correctly ensured that model settings are applied, it unconditionally overwrites the stream parameter from API requests, breaking:
The fix checks if stream exists in form_data before applying the model default:
# Before (always overwrites):ifmodel_info_params.get("stream_response")isnotNone:form_data["stream"]=model_info_params.get("stream_response")# After (respects API parameter):if"stream"notinform_dataandmodel_info_params.get("stream_response")isnotNone:form_data["stream"]=model_info_params.get("stream_response")
Changes
Modified backend/open_webui/main.py line 1628
Added check for existing stream parameter before applying model default
Added clarifying comment
Impact
✅Maintains #19154 fix - model setting still works as default
✅Fixes regression - API parameter now has priority
✅OpenAI API compatible - respects stream parameter per-request
✅Enables LangChain - streaming=True/False now works
🔄 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/open-webui/pull/21175
**Author:** [@konradzamojski](https://github.com/konradzamojski)
**Created:** 2/5/2026
**Status:** ❌ Closed
**Base:** `main` ← **Head:** `fix/api-stream-parameter-priority`
---
### 📝 Commits (1)
- [`ed568c4`](https://github.com/open-webui/open-webui/commit/ed568c485dba120c39b459daf82ebdc6c393de54) fix: respect API stream parameter over model settings
### 📊 Changes
**1 file changed** (+2 additions, -1 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/main.py` (+2 -1)
</details>
### 📄 Description
## Description
This PR fixes a regression introduced by commit f138be9 (issue #19154) where the `stream` parameter sent in API requests is always overridden by the model's `stream_response` setting.
## Problem
While #19154 correctly ensured that model settings are applied, it unconditionally overwrites the `stream` parameter from API requests, breaking:
- OpenAI API compatibility
- LangChain integration (`streaming=True/False` ignored)
- Per-request streaming control for any API client
## Solution
The fix checks if `stream` exists in `form_data` before applying the model default:
```python
# Before (always overwrites):
if model_info_params.get("stream_response") is not None:
form_data["stream"] = model_info_params.get("stream_response")
# After (respects API parameter):
if "stream" not in form_data and model_info_params.get("stream_response") is not None:
form_data["stream"] = model_info_params.get("stream_response")
```
## Changes
- Modified `backend/open_webui/main.py` line 1628
- Added check for existing `stream` parameter before applying model default
- Added clarifying comment
## Impact
- ✅ **Maintains #19154 fix** - model setting still works as default
- ✅ **Fixes regression** - API parameter now has priority
- ✅ **OpenAI API compatible** - respects stream parameter per-request
- ✅ **Enables LangChain** - `streaming=True/False` now works
- ✅ **100% backward compatible** - no breaking changes
## Testing
Tested all scenarios:
| Test Case | API Param | Model Setting | Expected | Result |
|-----------|-----------|---------------|----------|---------|
| 1 | `stream: false` | any | No streaming | ✅ Pass |
| 2 | `stream: true` | any | Streaming | ✅ Pass |
| 3 | not provided | `false` | No streaming | ✅ Pass |
| 4 | not provided | `true` | Streaming | ✅ Pass |
## Related Issues
- Resolves: #21162
- Related: #19154 (original issue)
- Improves: OpenAI API compatibility
## Type of Change
- [x] Bug fix (non-breaking change which fixes an issue)
- [x] Regression fix
- [x] API compatibility improvement
## Checklist
- [x] Code follows project style guidelines
- [x] Changes tested thoroughly (all 4 scenarios)
- [x] No breaking changes
- [x] Backward compatible
- [x] Maintains fix from #19154
- [x] Improves OpenAI API compatibility
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21175
Author: @konradzamojski
Created: 2/5/2026
Status: ❌ Closed
Base:
main← Head:fix/api-stream-parameter-priority📝 Commits (1)
ed568c4fix: respect API stream parameter over model settings📊 Changes
1 file changed (+2 additions, -1 deletions)
View changed files
📝
backend/open_webui/main.py(+2 -1)📄 Description
Description
This PR fixes a regression introduced by commit
f138be9(issue #19154) where thestreamparameter sent in API requests is always overridden by the model'sstream_responsesetting.Problem
While #19154 correctly ensured that model settings are applied, it unconditionally overwrites the
streamparameter from API requests, breaking:streaming=True/Falseignored)Solution
The fix checks if
streamexists inform_databefore applying the model default:Changes
backend/open_webui/main.pyline 1628streamparameter before applying model defaultImpact
streaming=True/Falsenow worksTesting
Tested all scenarios:
stream: falsestream: truefalsetrueRelated Issues
Type of Change
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.