[PR #19985] [CLOSED] feat: Model Fallbacks for custom models from workspace section #25418

Closed
opened 2026-04-20 05:55:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/19985
Author: @Classic298
Created: 12/16/2025
Status: Closed

Base: devHead: model-fallbacks


📝 Commits (9)

📊 Changes

5 files changed (+140 additions, -9 deletions)

View changed files

📝 backend/open_webui/env.py (+4 -0)
📝 backend/open_webui/main.py (+21 -2)
📝 backend/open_webui/routers/ollama.py (+18 -0)
📝 backend/open_webui/routers/openai.py (+31 -6)
📝 backend/open_webui/utils/models.py (+66 -1)

📄 Description

Motivation:

Imagine a large open webui instance. Users create custom models.

One day, an announcement gets sent out: "in 3 weeks we will remove gpt-5, please adjust your custom models until then to use a different base model".

But some users may not see the announcement, some users may be on vacation, or sick, or else.
The created custom models may be mission critical for certain processes inside the company - this is what this PR solves.
If the configured base model for a custom model is not found, normally a "404: Model not found" error would appear.
Instead, the code inside openai.py, ollama.py and main.py will now attempt to fall back to the configured DEFAULT chat model configured by the admin inside the admin panel > models > settings > Default Models - and there use the first configured model.

ONLY if that configured default model also does not work (or is not configured), then an error is thrown for "404: Model not found".

All other requests are not affected by this change. This ONLY applies to custom models from the workspace section.

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/19985 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 12/16/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `model-fallbacks` --- ### 📝 Commits (9) - [`ad2df42`](https://github.com/open-webui/open-webui/commit/ad2df4209c43cd0622b3de6ee0914b954203eb40) feat: add model fallback to default model for custom models (#106) - [`355b012`](https://github.com/open-webui/open-webui/commit/355b0129dc9da698d07a4a1cb35b110e5d4af38b) feat: add model fallback to default model for custom models (#107) - [`f80fa79`](https://github.com/open-webui/open-webui/commit/f80fa799c7b1526a1f3cce7f851e33946c40e6f0) Claude/add model fallback jv3k o (#108) - [`2c76587`](https://github.com/open-webui/open-webui/commit/2c76587765718f193adeca7d328227567f45afb4) fix - [`47ffc33`](https://github.com/open-webui/open-webui/commit/47ffc3340ef440954a29dba98187208741709389) Merge branch 'dev' into model-fallbacks - [`b3ef87d`](https://github.com/open-webui/open-webui/commit/b3ef87d20f073191037dd89d573024377f9c856a) info log level. - [`ab233f8`](https://github.com/open-webui/open-webui/commit/ab233f82c11b0ba0027a298ecbab8a028ef951e3) Merge branch 'model-fallbacks' of https://github.com/Classic298/open-webui into model-fallbacks - [`a95acd4`](https://github.com/open-webui/open-webui/commit/a95acd4e29f0359d3099fb4eb3977f6426b740d0) Claude/add model fallback jv3k o (#124) - [`56da276`](https://github.com/open-webui/open-webui/commit/56da276954cf00153560b995aa3fad667bc01703) Update models.py ### 📊 Changes **5 files changed** (+140 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/env.py` (+4 -0) 📝 `backend/open_webui/main.py` (+21 -2) 📝 `backend/open_webui/routers/ollama.py` (+18 -0) 📝 `backend/open_webui/routers/openai.py` (+31 -6) 📝 `backend/open_webui/utils/models.py` (+66 -1) </details> ### 📄 Description # Motivation: Imagine a large open webui instance. Users create custom models. One day, an announcement gets sent out: "in 3 weeks we will remove gpt-5, please adjust your custom models until then to use a different base model". But some users may not see the announcement, some users may be on vacation, or sick, or else. The created custom models may be mission critical for certain processes inside the company - this is what this PR solves. **If the configured base model for a custom model is not found, normally a "404: Model not found" error would appear. Instead, the code inside openai.py, ollama.py and main.py will now attempt to fall back to the configured DEFAULT chat model configured by the admin inside the admin panel > models > settings > Default Models - and there use the first configured model.** **ONLY if that configured default model also does not work (or is not configured), then an error is thrown for "404: Model not found".** **All other requests are not affected by this change. This ONLY applies to custom models from the workspace section.** ### 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-04-20 05:55:45 -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#25418