[PR #11988] [MERGED] Updated middleware.py to add OpenRouter compatibility #9624

Closed
opened 2025-11-11 18:27:12 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/11988
Author: @binxn
Created: 3/23/2025
Status: Merged
Merged: 3/23/2025
Merged by: @tjbck

Base: devHead: dev


📝 Commits (1)

  • efd86e2 Updated middleware.py to add OpenRouter compatibility

📊 Changes

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

View changed files

📝 backend/open_webui/utils/middleware.py (+1 -1)

📄 Description

Description

  • Added OpenRouter "reasoning" field compatibility. Previously, only "reasoning_content" field was being checked, so OpenRouter requests on reasoning models did not output the thinking process in the UI as "reasoning_content" is not part of the object, but "reasoning" is

Changed

  • Conditional assignment to check and use either "reasoning_content" or "reasoning" field value

Additional Information

  • LiteLLM uses "reasoning_content" field, which is the only one being used on OpenWebUI, however, other providers like OpenRouter use "reasoning"

🔄 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/11988 **Author:** [@binxn](https://github.com/binxn) **Created:** 3/23/2025 **Status:** ✅ Merged **Merged:** 3/23/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `dev` --- ### 📝 Commits (1) - [`efd86e2`](https://github.com/open-webui/open-webui/commit/efd86e2cb4f2cb63f28fd67a0e4d2e945d5797a7) Updated middleware.py to add OpenRouter compatibility ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/middleware.py` (+1 -1) </details> ### 📄 Description ### Description - Added OpenRouter "reasoning" field compatibility. Previously, only "reasoning_content" field was being checked, so OpenRouter requests on reasoning models did not output the thinking process in the UI as "reasoning_content" is not part of the object, but "reasoning" is ### Changed - Conditional assignment to check and use either "reasoning_content" or "reasoning" field value --- ### Additional Information - [LiteLLM](https://docs.litellm.ai/docs/reasoning_content) uses "reasoning_content" field, which is the only one being used on OpenWebUI, however, other providers like [OpenRouter](https://openrouter.ai/docs/use-cases/reasoning-tokens) use "reasoning" --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-11 18:27:12 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#9624