From 686d8dc54c58ff2ad94a4a86da5acfa804f150b0 Mon Sep 17 00:00:00 2001 From: xyonium <38782737+xyonium@users.noreply.github.com> Date: Mon, 17 Aug 2026 14:53:00 +0800 Subject: [PATCH] fix: strip prefix id from model name in /responses endpoint (#28575) The /openai/responses endpoint forwarded the prefixed model id (e.g. "myprovider.gpt-4o") to the upstream provider instead of the stripped native name, causing "model not found" errors when a connection has a Prefix ID configured. generate_chat_completion() already strips the prefix before forwarding; apply the same strip_provider_model_prefix() call in responses() after the urlIdx routing (which needs the prefixed id) and re-serialize the body afterwards. Also fixes the Azure non-v1 deployment path, which built the deployment URL from the prefixed model name. Co-authored-by: Claude --- backend/open_webui/routers/openai.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/routers/openai.py b/backend/open_webui/routers/openai.py index 9aed4a8f13..70e37a2123 100644 --- a/backend/open_webui/routers/openai.py +++ b/backend/open_webui/routers/openai.py @@ -1847,8 +1847,6 @@ async def responses( # Enforce per-model access control await check_model_access(user, await Models.get_model_by_id(model_id), BYPASS_MODEL_ACCESS_CONTROL) - body = JSONCodec.dumps(payload) - if model_id: models = request.app.state.OPENAI_MODELS if not models or model_id not in models: @@ -1859,6 +1857,9 @@ async def responses( url, key, api_config = await get_openai_connection(idx) + payload['model'] = strip_provider_model_prefix(payload['model'], api_config.get('prefix_id')) + body = JSONCodec.dumps(payload) + r = None streaming = False