mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 21:09:41 -05:00
[GH-ISSUE #22578] issue: OpenRouter model enable/disable state becomes stale or inverted after switching between restricted model_ids and full catalog #35283
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?
Originally created by @random42 on GitHub (Mar 11, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/22578
Check Existing Issues
Related but not equivalent:
This issue appears to be the combination of both behaviors and can leave the admin Models page in a stale or apparently inverted state for OpenRouter-discovered models.
Installation Method
Other
Open WebUI Version
Not provided
Ollama Version (if applicable)
Not applicable
Operating System
macOS
Browser (if applicable)
Not provided
Confirmation
README.md.Expected Behavior
When using OpenRouter without specifying
model_ids, then disabling/enabling models in Admin > Settings > Models, the saved enabled/disabled state should remain consistent.Changing the OpenRouter connection between:
model_idslist, andshould not resurrect stale per-model state from an older catalog in a way that makes the current model set appear inverted or inconsistent.
Bulk
Enable All/Disable Allshould persist reliably for discovered provider models, not just update the UI optimistically.Actual Behavior
After switching back and forth between restricted
model_idsand the full discovered OpenRouter catalog, the Models admin page can end up in a stale or effectively inverted state.Observed symptom from the reporter:
GPT 5.2or other earlier OpenRouter models may reappear with their previous saved disabled state, while newly selected models do not reflect the most recent bulk action.This makes the model enable/disable state look random or inverted, but it appears to be deterministic reuse of stale saved model records by exact model ID, combined with bulk actions not persisting for many discovered models.
Steps to Reproduce
Reporter timeline, reproduced as a sequential scenario:
model_ids, so Open WebUI discovers the full catalog from OpenRouter.model_idslist.model_idsagain so Open WebUI discovers the full catalog once more.GPT 5.4instead ofGPT 5.2.Concrete user report:
Logs & Screenshots
No logs or screenshots available yet.
Code-level findings from local inspection of
mainbranch:Base/provider models default to enabled when there is no saved DB row.
src/lib/components/admin/Settings/Models.svelteinitializes discovered models withis_active: trueif no workspace model row exists.Bulk
Enable All/Disable Allonly call the toggle endpoint.src/lib/components/admin/Settings/Models.svelte/api/v1/models/model/toggle?id=...for each model.The toggle endpoint only works for models that already have a DB row.
backend/open_webui/routers/models.py/model/togglereturnsNOT_FOUND.Individual toggles do create a DB row on first toggle.
src/lib/components/admin/Settings/Models.svelte/api/v1/models/createwith the currentis_activevalue.Saved model rows are later reapplied by exact model ID when provider models are rediscovered.
backend/open_webui/utils/models.pyModels.get_all_models()and overlaid onto discovered provider models by matchingcustom_model.id.is_active == false, the discovered model is removed from the merged model list.Taken together, this means:
model_idsand the full catalog.Additional Information
Possible fixes:
Fix bulk persistence for discovered provider models.
Enable All/Disable Allshould create missing model rows before toggling, or use an upsert/set-active endpoint instead of a pure toggle endpoint.Replace toggle semantics with explicit set semantics.
set model active = true/falseendpoint is safer than repeatedly callingtoggle, especially for optimistic UI flows.Do not persist unrelated model metadata on first disable/enable unless needed.
Consider cleanup or invalidation of stale saved rows for provider-discovered models when the upstream model catalog changes materially.
model_idsand the full discovered list.Revisit issue #21959.
A practical workaround today seems to be deleting the offending rows from the
modeltable, similar to the workaround mentioned in #11293, then reconfiguring models from scratch.