From 6f87b4e649175af353d8c3e718cbcd29056dab09 Mon Sep 17 00:00:00 2001 From: Nathan Price Date: Thu, 18 Jun 2026 07:19:31 -0500 Subject: [PATCH] refactor(router): drop redundant ttft deadline guard asyncio.wait_for already raises TimeoutError for a non-positive timeout, so the explicit remaining<=0 check duplicated wait_for's own behavior. Removing it keeps the same observable result (litellm.Timeout via the except clause) and lets wait_for return an already-ready chunk instead of spuriously timing out. --- litellm/router.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/litellm/router.py b/litellm/router.py index 6bf2733fdc6..0a142f98546 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -2917,8 +2917,6 @@ class Router: chunk = await aiter.__anext__() else: remaining = deadline - loop.time() - if remaining <= 0: - raise asyncio.TimeoutError chunk = await asyncio.wait_for( aiter.__anext__(), timeout=remaining )