[PR #22441] [CLOSED] feat: support upstream model metadata from /v1/models response #65554

Closed
opened 2026-05-06 11:24:52 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22441
Author: @mpcusack-altos
Created: 3/8/2026
Status: Closed

Base: devHead: feat/upstream-model-metadata


📝 Commits (1)

  • 4a223a3 feat: support upstream model metadata from /v1/models response

📊 Changes

2 files changed (+65 additions, -27 deletions)

View changed files

📝 backend/open_webui/routers/models.py (+39 -27)
📝 backend/open_webui/utils/models.py (+26 -0)

📄 Description

Pull Request Checklist

  • Target branch: dev
  • Description: See below
  • Changelog: See below
  • Testing: Manual testing with a custom OpenAI-compatible backend returning meta in /v1/models. Verified: upstream meta populates icons, descriptions, and capabilities in UI; DB overrides take precedence; DEFAULT_MODEL_METADATA still applies as base.
  • Code review:
  • Title Prefix: feat

Changelog Entry

Description

Allow OpenAI-compatible backends to include an optional meta object in their /v1/models response entries. OpenWebUI reads profile_image_url, description, and capabilities from it — applying them as model-specific defaults that sit between DEFAULT_MODEL_METADATA (global) and DB model overrides (per-model admin config).

This enables managing model presentation (icons, descriptions, capability flags) as infrastructure-as-code on the backend/proxy side, without requiring manual configuration in the OpenWebUI admin UI for each model.

Precedence (lowest to highest):

  1. DEFAULT_MODEL_METADATA config (global blanket defaults for all models)
  2. Upstream meta from /v1/models response (model-specific from the backend)
  3. DB model override (admin UI / API)

Example upstream /v1/models response entry

{
  "id": "claude-sonnet-4-20250514",
  "object": "model",
  "owned_by": "anthropic",
  "name": "Claude Sonnet 4",
  "meta": {
    "profile_image_url": "https://example.com/anthropic-icon.png",
    "description": "Anthropic's most capable model",
    "capabilities": { "vision": true }
  }
}

All meta fields are optional — backends can include any combination of profile_image_url, description, and capabilities.

Added

  • Upstream model metadata support: OpenWebUI now reads meta.profile_image_url, meta.description, and meta.capabilities from /v1/models response entries served by OpenAI-compatible backends (including Ollama)

Changed

  • backend/open_webui/utils/models.pyget_all_models(): added a loop after the DEFAULT_MODEL_METADATA block that applies upstream meta fields, skipping models with DB overrides
  • backend/open_webui/routers/models.pyget_model_profile_image(): falls back to in-memory upstream model metadata when no DB model entry exists, so profile_image_url from upstream /v1/models is served even without a DB override (OpenWebUI strips profile_image_url from the /api/models payload to reduce size and serves images via this dedicated endpoint instead)

Why no other files need changes

  • openai.py: Already preserves all upstream fields via **model spread and stores the original in model["openai"]
  • Frontend (Svelte): Already reads info.meta for display and fetches profile images via /model/profile/image

Additional Information

  • ~65 lines changed across 2 files
  • No new dependencies
  • No frontend changes required
  • No breaking changes — purely additive; backends that don't include meta are unaffected

Contributor License Agreement


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/22441 **Author:** [@mpcusack-altos](https://github.com/mpcusack-altos) **Created:** 3/8/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `feat/upstream-model-metadata` --- ### 📝 Commits (1) - [`4a223a3`](https://github.com/open-webui/open-webui/commit/4a223a3f410f862367d018e1c4c11b049433ad95) feat: support upstream model metadata from /v1/models response ### 📊 Changes **2 files changed** (+65 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/models.py` (+39 -27) 📝 `backend/open_webui/utils/models.py` (+26 -0) </details> ### 📄 Description # Pull Request Checklist - [x] **Target branch:** `dev` - [x] **Description:** See below - [x] **Changelog:** See below - [x] **Testing:** Manual testing with a custom OpenAI-compatible backend returning `meta` in `/v1/models`. Verified: upstream meta populates icons, descriptions, and capabilities in UI; DB overrides take precedence; `DEFAULT_MODEL_METADATA` still applies as base. - [ ] **Code review:** - [x] **Title Prefix:** `feat` # Changelog Entry ### Description Allow OpenAI-compatible backends to include an optional `meta` object in their `/v1/models` response entries. OpenWebUI reads `profile_image_url`, `description`, and `capabilities` from it — applying them as model-specific defaults that sit between `DEFAULT_MODEL_METADATA` (global) and DB model overrides (per-model admin config). This enables managing model presentation (icons, descriptions, capability flags) as infrastructure-as-code on the backend/proxy side, without requiring manual configuration in the OpenWebUI admin UI for each model. **Precedence (lowest to highest):** 1. `DEFAULT_MODEL_METADATA` config (global blanket defaults for all models) 2. Upstream `meta` from `/v1/models` response (model-specific from the backend) 3. DB model override (admin UI / API) ### Example upstream `/v1/models` response entry ```json { "id": "claude-sonnet-4-20250514", "object": "model", "owned_by": "anthropic", "name": "Claude Sonnet 4", "meta": { "profile_image_url": "https://example.com/anthropic-icon.png", "description": "Anthropic's most capable model", "capabilities": { "vision": true } } } ``` All `meta` fields are optional — backends can include any combination of `profile_image_url`, `description`, and `capabilities`. ### Added - Upstream model metadata support: OpenWebUI now reads `meta.profile_image_url`, `meta.description`, and `meta.capabilities` from `/v1/models` response entries served by OpenAI-compatible backends (including Ollama) ### Changed - **`backend/open_webui/utils/models.py`** — `get_all_models()`: added a loop after the `DEFAULT_MODEL_METADATA` block that applies upstream `meta` fields, skipping models with DB overrides - **`backend/open_webui/routers/models.py`** — `get_model_profile_image()`: falls back to in-memory upstream model metadata when no DB model entry exists, so `profile_image_url` from upstream `/v1/models` is served even without a DB override (OpenWebUI strips `profile_image_url` from the `/api/models` payload to reduce size and serves images via this dedicated endpoint instead) ### Why no other files need changes - **openai.py**: Already preserves all upstream fields via `**model` spread and stores the original in `model["openai"]` - **Frontend (Svelte)**: Already reads `info.meta` for display and fetches profile images via `/model/profile/image` --- ### Additional Information - ~65 lines changed across 2 files - No new dependencies - No frontend changes required - No breaking changes — purely additive; backends that don't include `meta` are unaffected ### Contributor License Agreement - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 11:24:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#65554