mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[PR #15122] [MERGED] feat(azure): Add stream_options to payload if api_version supports #127382
Reference in New Issue
Block a user
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?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/15122
Author: @tcx4c70
Created: 6/18/2025
Status: ✅ Merged
Merged: 6/20/2025
Merged by: @tjbck
Base:
dev← Head:feat/add_stream_options_to_azure📝 Commits (1)
baafdb7feat(openai): Add stream_options to payload if api_version supports📊 Changes
1 file changed (+21 additions, -14 deletions)
View changed files
📝
backend/open_webui/routers/openai.py(+21 -14)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Although it's not documented in MS Azure doc, Azure OpenAI supports
stream_optionssince API version 2024-09-01-preview.This PR adds
stream_optionsto the payload if the API version supports it. To avoid break changes, it will check the API version before addingstream_optionsto payload.Added
Changed
get_azure_allowed_paramsfunction that adjusts based onapi_versionapi_versionparameter toconvert_to_azure_payloadfor dynamic parameter filteringapi_versionconsistently for better compatibilityBreaking Changes
I don't think it will introduce any break changes since it has already check the API version in the code. For the user who use old API version, it will change nothing.
Screenshots or Videos
After the change, Open WebUI will retrieve and display the token usage for ChageGPT models from Azure AI:

(For other models from Azure AI, like DeepSeek and Grok, it seems that they will response token usage even if we don't add
stream_optionsto request)Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.