mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-15 21:19:39 -05:00
issue: /api/models endpoint slow & very heavy with larger instances #6840
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 @taylorwilsdon on GitHub (Nov 5, 2025).
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
v0.6.34
Ollama Version (if applicable)
No response
Operating System
Ubuntu
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
Loading the base route ({yourowuihost.com/}) should load quickly and the necessary metadata for the models picker should just be ID, display name, link etc
Actual Behavior
An enormous payload (in my case, 4.3mb) is returned that includes the entire system prompt for all 350+ models, base64 encoded images for every single one etc.
Interestingly, we have gotten reports from users who aren't admins and can't see all models that their load times are even slower even though the payload is smaller. Potentially due to filtering before it responds?
Steps to Reproduce
Load your OWUI instance with 300 models configured
Logs & Screenshots
Additional Information
No response
@silentoplayz commented on GitHub (Nov 6, 2025):
Related - https://github.com/open-webui/open-webui/issues/17266
@tjbck commented on GitHub (Nov 10, 2025):
I believe we can just drop profile_image_urls and that should reduce the size of the response significantly
@adam-skalicky commented on GitHub (Nov 11, 2025):
I believe the issue is the lack of optimization of the
get_filtered_modelsfunction inutils/models.pywhich is invoked as part of /api/models for non-admin users when bypass is not enabled.https://github.com/open-webui/open-webui/blob/main/backend/open_webui/utils/models.py#L352C5-L352C24
It is invoking
has_accessfor every model without providing thegroup_idlist causing a DB hit to get a group list for the user for each model.If you examine the
get_models_by_user_idfunction inmodels/models.pyit preloads the user group IDs prior to looping through the models.https://github.com/open-webui/open-webui/blob/main/backend/open_webui/models/models.py#L206
Testing the runtime out locally with stubbed responses, I see a ~4.7s response time in our environment with 400+ models with a simulated 10ms delay on the group fetch, but preloading the group IDs brings this to ~0.2s.
I think /
api/modelsshould either move to using theget_models_by_user_idfunction orget_filtered_modelsshould be updated to preload the group IDs.@adam-skalicky commented on GitHub (Nov 11, 2025):
I see
get_filtered_modelshas additional logic thatget_models_by_user_idwould not have without a bit of refactoring. I will create a PR to suggest the group pre-seed for has_access likeget_models_by_user_id@adam-skalicky commented on GitHub (Nov 11, 2025):
See https://github.com/open-webui/open-webui/pull/19097 for the improvement