[GH-ISSUE #1385] Models from an external OpenAI-compatible connection are missing from /api/models when prefix_id is empty #169

Open
opened 2026-10-18 14:09:35 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @CFiora on GitHub (Sep 8, 2026).
Original GitHub issue: https://github.com/open-webui/docs/issues/1385

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

  1. 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.
  2. Enable the connection (enable: true), verify connection succeeds (POST /openai/verify returns 200).
  3. 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.)
  4. 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.
  5. Edit the connection and set prefix_id to any non-empty string (e.g. lite/).
  6. 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.

Originally created by @CFiora on GitHub (Sep 8, 2026). Original GitHub issue: https://github.com/open-webui/docs/issues/1385 ### 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 1. 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**. 2. Enable the connection (`enable: true`), verify connection succeeds (`POST /openai/verify` returns 200). 3. 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.) 4. 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. 5. Edit the connection and set `prefix_id` to any non-empty string (e.g. `lite/`). 6. 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`): ```json { "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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/docs#169
No description provided.