mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[GH-ISSUE #18950] issue: /api/models endpoint slow & very heavy with larger instances #57393
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).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18950
Originally assigned to: @tjbck on GitHub.
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
@luke-wren commented on GitHub (Nov 19, 2025):
We use Entra Id SSO so the user's avatars are synced, these are 1024x1024 images in a base64 encoded jpeg string.
This means various API endpoints which include the "user" object are hugely bloated, our tools API endpoint returns a payload over 100MB!
Luckily for our users this isn't noticeable since its mostly just the admin endpoints that include this info.
I've observed this on the following endpoints:
Suggestions:
or/and
@Classic298 commented on GitHub (Nov 19, 2025):
@luke-haynes-wren
from your second suggestion: do you mean NOT setting user's avatars?
This is possible, by setting OAUTH_UPDATE_PICTURE_ON_LOGIN to false and setting OAUTH_PICTURE_CLAIM to ""
If OAUTH_PICTURE_CLAIM is set to '' (empty string), then the OAuth picture claim is disabled and the user profile pictures will not be saved.
@zhenanekh-pixel commented on GitHub (Nov 19, 2025):
When will nano banana 2 start working?
@Classic298 commented on GitHub (Nov 19, 2025):
@zhenanekh-pixel
already working perfectly with this setup:
https://docs.openwebui.com/getting-started/env-configuration#gemini
For openrouter support OR direct model integration support (not via image-editing in admin panel) you need to wait for 0.6.37
@Classic298 commented on GitHub (Nov 19, 2025):
@zhenanekh-pixel
and please keep it on topic, this issue is unrelated to gemini image edit
@luke-wren commented on GitHub (Nov 19, 2025):
I like that users avatars are synced, it keeps things cohesive across the org.
My suggestion was to omit the users avatar from API responses as this makes up about 95% of the overall payload size (in our case). Eg in the image below.
In most cases, the avatar returned in the API isn't displayed on the page so isn't needed anyway.
@adam-skalicky commented on GitHub (Nov 19, 2025):
I think this is drifting a little off topic. The original issue relates to the model endpoint being slow which is fixed in dev.
That said, I do think there's a wholistic conversation to be had about metadata image handling that should happen in another thread. User data and model images are all base64 encoded and passed as json which is fine for a one off but can dominate objects when used ubiquitously. Assuming all images are not sensitive, maybe we should serve them from the file system via a UUID and dedicated fetch endpoint that simply looks for a live token.
Either way, I feel this issue is resolved. @taylorwilsdon perhaps we close this out in favour of another thread?
@tjbck commented on GitHub (Nov 21, 2025):
profile_image_url in
metafield is also dropped for models endpoint, @taylorwilsdon let us know if that addresses the issue!@taylorwilsdon commented on GitHub (Nov 21, 2025):
Hell yeah excited to take it for a spin, we've seen dramatic performance increases from the dev branch already this is icing on the cake