Bug Description
When an external OpenAI-compatible connection has an empty prefix_id, the models it returns are correctly fetched when querying that connection individually (/openai/models/{idx}), but they are silently dropped when the models are merged/aggregated into the final list at /api/models. No error is logged.
Adding a non-empty prefix_id to the same connection immediately fixes the issue and the models appear in /api/models.
Environment
- open-webui image:
ghcr.io/open-webui/open-webui:main
- Deployment: Docker, self-hosted
- Backend proxy: LiteLLM (
ghcr.io/berriai/litellm:main-latest), acting as an OpenAI-compatible endpoint on the same Docker network
Steps to Reproduce
- Add an external OpenAI API connection pointing to an OpenAI-compatible endpoint (in my case, a local LiteLLM proxy at
http://litellm:4000/v1), with prefix_id left empty.
- Enable the connection (
enable: true), verify connection succeeds (POST /openai/verify returns 200).
- Query that connection's models directly:
GET /openai/models/{connection_index}
→ Returns the full list of models correctly (confirmed 8 models returned, e.g. packy.aws-q/claude-sonnet-5, packy.cc-sale/claude-sonnet-5, etc.)
- Query the aggregated model list:
GET /api/models
→ The models from this connection are completely absent, even though other connections (with non-empty prefix_id) show up correctly.
- Edit the connection and set
prefix_id to any non-empty string (e.g. lite/).
- Query
/api/models again → the models now appear correctly (prefixed as expected).
Expected Behavior
Models from a connection with an empty prefix_id should still appear in the aggregated /api/models response, the same as models from a connection with a prefix_id set — only the model ID prefixing should differ, not whether the models are included at all.
Actual Behavior
Models are silently dropped during aggregation when prefix_id is an empty string (""). No error, no warning in logs — connection verification and individual model fetch (/openai/models/{idx}) both succeed.
Additional Context
OPENAI_API_CONFIGS for the affected connection (via GET /openai/config):
{
"enable": true,
"tags": [],
"prefix_id": "",
"model_ids": [],
"connection_type": "external",
"auth_type": "bearer",
"passthrough_params": []
}
- Other connections in the same config, with non-empty
prefix_id, work as expected.
- Logs during the failing request show only
200 OK responses for all relevant endpoints (/openai/verify, /openai/models/{idx}, /api/models) — no exceptions or errors are logged, making this hard to diagnose.
Suggested Fix Direction
The model-merging logic likely uses prefix_id as part of a key (e.g., for deduplication or grouping), and an empty string may be causing models to be overwritten, filtered, or excluded unintentionally during that step. Would appreciate a look at whatever function assembles the aggregated model list at /api/models to see how it treats connections with an empty/falsy prefix_id.
Workaround
Setting a non-empty prefix_id (e.g. a short string like lite/) on the affected connection resolves the issue completely.
Bug Description
When an external OpenAI-compatible connection has an empty
prefix_id, the models it returns are correctly fetched when querying that connection individually (/openai/models/{idx}), but they are silently dropped when the models are merged/aggregated into the final list at/api/models. No error is logged.Adding a non-empty
prefix_idto the same connection immediately fixes the issue and the models appear in/api/models.Environment
ghcr.io/open-webui/open-webui:mainghcr.io/berriai/litellm:main-latest), acting as an OpenAI-compatible endpoint on the same Docker networkSteps to Reproduce
http://litellm:4000/v1), withprefix_idleft empty.enable: true), verify connection succeeds (POST /openai/verifyreturns 200).GET /openai/models/{connection_index}
→ Returns the full list of models correctly (confirmed 8 models returned, e.g.
packy.aws-q/claude-sonnet-5,packy.cc-sale/claude-sonnet-5, etc.)GET /api/models
→ The models from this connection are completely absent, even though other connections (with non-empty
prefix_id) show up correctly.prefix_idto any non-empty string (e.g.lite/)./api/modelsagain → the models now appear correctly (prefixed as expected).Expected Behavior
Models from a connection with an empty
prefix_idshould still appear in the aggregated/api/modelsresponse, the same as models from a connection with aprefix_idset — only the model ID prefixing should differ, not whether the models are included at all.Actual Behavior
Models are silently dropped during aggregation when
prefix_idis an empty string (""). No error, no warning in logs — connection verification and individual model fetch (/openai/models/{idx}) both succeed.Additional Context
OPENAI_API_CONFIGSfor the affected connection (viaGET /openai/config):{ "enable": true, "tags": [], "prefix_id": "", "model_ids": [], "connection_type": "external", "auth_type": "bearer", "passthrough_params": [] }prefix_id, work as expected.200 OKresponses for all relevant endpoints (/openai/verify,/openai/models/{idx},/api/models) — no exceptions or errors are logged, making this hard to diagnose.Suggested Fix Direction
The model-merging logic likely uses
prefix_idas part of a key (e.g., for deduplication or grouping), and an empty string may be causing models to be overwritten, filtered, or excluded unintentionally during that step. Would appreciate a look at whatever function assembles the aggregated model list at/api/modelsto see how it treats connections with an empty/falsyprefix_id.Workaround
Setting a non-empty
prefix_id(e.g. a short string likelite/) on the affected connection resolves the issue completely.