From bae22752d3995f573a373ee1ae4735b746d952a9 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 14 Oct 2026 22:00:41 +0200 Subject: [PATCH] feat: add {{MODEL_ID}} placeholder for custom connection headers (#32426) Custom headers on connections and tool servers could pass the chat, message, user and task to downstream services, but not which model the request was for. Chat requests can now use {{MODEL_ID}}, which holds the ID of the model handling the request; for a workspace model that is the workspace model's own ID. In a multi-model chat each model's request carries its own ID, so downstream services can route by model or log usage per model. Fixes #30006 --- backend/open_webui/utils/headers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/open_webui/utils/headers.py b/backend/open_webui/utils/headers.py index 8b73ca40d8..00262df0f1 100644 --- a/backend/open_webui/utils/headers.py +++ b/backend/open_webui/utils/headers.py @@ -144,6 +144,7 @@ def parse_custom_headers( '{{FILE_NAME}}': metadata.get('file_name', '') or '', '{{FILE_CONTENT_TYPE}}': metadata.get('file_content_type', '') or '', '{{TASK}}': metadata.get('task', '') or '', + '{{MODEL_ID}}': metadata.get('model_id', '') or '', '{{USER_ID}}': (user.id if user else '') or '', '{{USER_NAME}}': (user.name.strip() if user else '') or '', '{{USER_EMAIL}}': (user.email.strip() if user else '') or '',