mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[PR #19985] [CLOSED] feat: Model Fallbacks for custom models from workspace section #25418
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/19985
Author: @Classic298
Created: 12/16/2025
Status: ❌ Closed
Base:
dev← Head:model-fallbacks📝 Commits (9)
ad2df42feat: add model fallback to default model for custom models (#106)355b012feat: add model fallback to default model for custom models (#107)f80fa79Claude/add model fallback jv3k o (#108)2c76587fix47ffc33Merge branch 'dev' into model-fallbacksb3ef87dinfo log level.ab233f8Merge branch 'model-fallbacks' of https://github.com/Classic298/open-webui into model-fallbacksa95acd4Claude/add model fallback jv3k o (#124)56da276Update models.py📊 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.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.