From 785bc2ca8c1326cf1957dc0829d65ddaedb4b67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Garc=C3=ADa=20Iglesias?= Date: Sun, 26 Apr 2026 22:23:17 -0300 Subject: [PATCH] fix: coerce non-string custom header values to str before sending aiohttp requires all header values to be strings. Non-string values (e.g. integers) stored in the connection headers config were passed through as-is, causing a serialization error at request time. Co-Authored-By: Claude Sonnet 4.6 --- backend/open_webui/routers/openai.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/routers/openai.py b/backend/open_webui/routers/openai.py index ab9c30cfe9..5a2f34fc86 100644 --- a/backend/open_webui/routers/openai.py +++ b/backend/open_webui/routers/openai.py @@ -223,9 +223,10 @@ async def get_headers_and_cookies( } custom_headers = {} for k, v in config.get('headers').items(): - if isinstance(v, str): - for token, value in template_vars.items(): - v = v.replace(token, value) + if not isinstance(v, str): + v = str(v) + for token, value in template_vars.items(): + v = v.replace(token, value) custom_headers[k] = v headers = {**headers, **custom_headers}