mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #18244] [CLOSED] fix: Deduplicate model entries when multiple endpoints return the same model ID #40351
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/18244
Author: @kindredzhang
Created: 10/11/2025
Status: ❌ Closed
Base:
main← Head:fix-duplicated-model-ids📝 Commits (1)
6b5e14cfix: add deduplication for model IDs to prevent duplicate models in list📊 Changes
1 file changed (+27 additions, -24 deletions)
View changed files
📝
backend/open_webui/routers/openai.py(+27 -24)📄 Description
Summary
Deduplicate model entries when multiple endpoints return the same model ID to prevent frontend crashes and improve user experience for proxy gateway users.
Motivation / Use-Case
Most users of openai-python do not call api.openai.com directly; they route through unified gateways (One-API, New-API, Cloudflare-AI, etc.). These gateways aggregate dozens of providers into a single
/v1/modelsresponse, so identical IDs (e.g.,gpt-3.5-turbo,babbage-002) appear many times under different indexes.The frontend settings page uses a Svelte each block keyed by ID; duplicate keys trigger:
Once thrown, the route crashes and the UI becomes unresponsive—users must force-refresh the browser and have no way to configure models manually.
This server-side deduplication lets "proxy users" consume the list out-of-the-box without any breaking changes or manual allow-lists.
Changes
seen_ids: set[str]insidemerge_models_lists()Testing
pytest tests/passes locallyScreenshots
Type of Change
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.