From ab1ad7bae4ba94d9ef5553d9df065521e8f428a2 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Tue, 28 Jul 2026 23:12:53 +0200 Subject: [PATCH] fix: use the pooled client timeout for the Anthropic Messages passthrough The native `/api/v1/messages` passthrough still referenced `openai.AIOHTTP_CLIENT_TIMEOUT`, which stopped existing when `routers/openai.py` moved onto `session_pool.get_client_timeout()`. Every passthrough request therefore raised `AttributeError: module 'open_webui.routers.openai' has no attribute 'AIOHTTP_CLIENT_TIMEOUT'` before it was sent, and the surrounding handler turned that into a 502 "Open WebUI: Server Connection Error", so Anthropic-format clients such as Cline could not reach any model at all. Use `get_client_timeout(stream=...)` like the OpenAI and Ollama proxies do, so the configured `AIOHTTP_CLIENT_TIMEOUT` applies and streaming requests additionally get the idle-read timeout. Fixes #27595 --- backend/open_webui/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index fb558cfe63..6cf038e314 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -264,7 +264,7 @@ from open_webui.utils.oauth import ( from open_webui.utils.plugin import install_tool_and_function_dependencies from open_webui.utils.redis import get_redis_client from open_webui.utils.security_headers import SecurityHeadersMiddleware -from open_webui.utils.session_pool import cleanup_response, get_session, stream_wrapper +from open_webui.utils.session_pool import cleanup_response, get_client_timeout, get_session, stream_wrapper from open_webui.utils.tools import set_terminal_servers, set_tool_servers if SAFE_MODE: @@ -1864,7 +1864,7 @@ async def passthrough_anthropic_messages(request: Request, form_data: dict, user headers=headers, cookies=cookies, ssl=AIOHTTP_CLIENT_SESSION_SSL, - timeout=aiohttp.ClientTimeout(total=openai.AIOHTTP_CLIENT_TIMEOUT), + timeout=get_client_timeout(stream=bool(payload.get('stream'))), ) if 'text/event-stream' in response.headers.get('Content-Type', ''):