[PR #20899] [CLOSED] feat: Add support for model parsing in OpenAI proxy handler #64671

Closed
opened 2026-05-06 10:19:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/20899
Author: @gaby
Created: 1/23/2026
Status: Closed

Base: devHead: update-proxy-handler-for-model-parsing


📝 Commits (9)

  • d0ffd25 Route OpenAI proxy by model
  • 02cbcf1 Update backend/open_webui/routers/openai.py
  • 0b9e864 Simplify model entry check in openai.py
  • c878ba8 Update backend/open_webui/routers/openai.py
  • db6700a Apply suggestions from code review
  • d0bff6b Apply suggestions from code review
  • ae80e92 Merge branch 'dev' into update-proxy-handler-for-model-parsing
  • a36d036 Merge branch 'dev' into update-proxy-handler-for-model-parsing
  • ce24308 Update backend/open_webui/routers/openai.py

📊 Changes

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

View changed files

📝 backend/open_webui/routers/openai.py (+38 -3)

📄 Description

Description

  • Ensure proxy forwards requests to the correct upstream by parsing JSON proxy payloads and honoring the model field when present.
  • Use the resolved model routing in OPENAI_MODELS to pick the correct OPENAI_API_BASE_URLS/keys/configs instead of always using index 0.
  • If the model is not found, default to using index 0.

Motivation

  • My backend is vLLM which supports /skills and /v1/responses endpoints. When using multiple models in OpenWebUI the proxy routes only use the OpenAI URL defined via ENV, if not present it defaults to whatever last model is on the list of OpenAI urls.
  • The proxy routes do not allow using the models defined in OpenWebUI.
  • This pull request will allow users to define models in OpenWebUI and proxy to their backends to use routes defined there, ex: skills, responses.

Note

  • The dev branch is failing ruff formatting, but from my checks the code in this file is correctly formatted.
  • This PR was created with the help of codex and copilot.

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.

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 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/20899 **Author:** [@gaby](https://github.com/gaby) **Created:** 1/23/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `update-proxy-handler-for-model-parsing` --- ### 📝 Commits (9) - [`d0ffd25`](https://github.com/open-webui/open-webui/commit/d0ffd25d5c5dea1f0bb0529750aff86649e2cb35) Route OpenAI proxy by model - [`02cbcf1`](https://github.com/open-webui/open-webui/commit/02cbcf1338bfe73af79166b792b3ed94f91bc0a5) Update backend/open_webui/routers/openai.py - [`0b9e864`](https://github.com/open-webui/open-webui/commit/0b9e864a04d1e0b7441361b75a11fcea6778f59c) Simplify model entry check in openai.py - [`c878ba8`](https://github.com/open-webui/open-webui/commit/c878ba891ec5005e9445ebd2a2dc756834920d6a) Update backend/open_webui/routers/openai.py - [`db6700a`](https://github.com/open-webui/open-webui/commit/db6700a3c83c1cd221e5cf884c8c2b9cdc4d6d9b) Apply suggestions from code review - [`d0bff6b`](https://github.com/open-webui/open-webui/commit/d0bff6b673c29debe74a68c43bbcc32ae4703772) Apply suggestions from code review - [`ae80e92`](https://github.com/open-webui/open-webui/commit/ae80e9272ef66a7720b9cf6ccefa4eeb9277d6e1) Merge branch 'dev' into update-proxy-handler-for-model-parsing - [`a36d036`](https://github.com/open-webui/open-webui/commit/a36d0360755f88ed58b24df78a07633731c97aaf) Merge branch 'dev' into update-proxy-handler-for-model-parsing - [`ce24308`](https://github.com/open-webui/open-webui/commit/ce2430896b35e9aaf733d2179924a41aa3569edc) Update backend/open_webui/routers/openai.py ### 📊 Changes **1 file changed** (+38 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/openai.py` (+38 -3) </details> ### 📄 Description ### Description - Ensure proxy forwards requests to the correct upstream by parsing JSON proxy payloads and honoring the `model` field when present. - Use the resolved model routing in `OPENAI_MODELS` to pick the correct `OPENAI_API_BASE_URLS`/keys/configs instead of always using index `0`. - If the model is not found, default to using index `0`. ### Motivation - My backend is vLLM which supports /skills and /v1/responses endpoints. When using multiple models in OpenWebUI the proxy routes only use the OpenAI URL defined via ENV, if not present it defaults to whatever last model is on the list of OpenAI urls. - The proxy routes do not allow using the models defined in OpenWebUI. - This pull request will allow users to define models in OpenWebUI and proxy to their backends to use routes defined there, ex: skills, responses. ### Note - The dev branch is failing ruff formatting, but from my checks the code in this file is correctly formatted. - This PR was created with the help of codex and copilot. ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <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 2026-05-06 10:19:01 -05: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#64671