From 3a970efd6278dbb95fa474921d3bb20668cac146 Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Sun, 15 Mar 2026 18:55:08 -0600 Subject: [PATCH] fix: increase httpx read timeout to 600s for large context SSE streams With 200k+ token contexts, Anthropic can take 60+ seconds for time to first token. The 300s timeout was too aggressive for SSE reads during long thinking phases. --- src/mnemosyne/gateway.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mnemosyne/gateway.py b/src/mnemosyne/gateway.py index 7aa385d..a565a3c 100644 --- a/src/mnemosyne/gateway.py +++ b/src/mnemosyne/gateway.py @@ -1621,10 +1621,12 @@ def create_app( clients.update( { "anthropic": httpx.Client( - base_url=anthropic_upstream, timeout=httpx.Timeout(300.0, connect=30.0) + base_url=anthropic_upstream, + timeout=httpx.Timeout(600.0, connect=30.0, read=600.0), ), "openai": httpx.Client( - base_url=openai_upstream, timeout=httpx.Timeout(300.0, connect=30.0) + base_url=openai_upstream, + timeout=httpx.Timeout(600.0, connect=30.0, read=600.0), ), } )