From 267c02acf05b92775d2a320c3ec6fc4b27b18960 Mon Sep 17 00:00:00 2001 From: kigland Date: Sun, 18 Oct 2026 16:39:05 +0800 Subject: [PATCH] fix: keep legacy parser outside strict duration path --- litellm/litellm_core_utils/duration_parser.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/litellm/litellm_core_utils/duration_parser.py b/litellm/litellm_core_utils/duration_parser.py index 47cb1dce480..78a4c7c1222 100644 --- a/litellm/litellm_core_utils/duration_parser.py +++ b/litellm/litellm_core_utils/duration_parser.py @@ -259,14 +259,11 @@ def _setup_timezone(current_time: datetime, timezone_str: str = "UTC") -> tuple[ def _parse_duration(duration: str) -> tuple[int | None, str | None]: """Parse the duration string into value and unit.""" - match: Final = re.fullmatch(r"(\d+)([a-z]+)", duration) + match: Final = re.match(r"(\d+)([a-z]+)", duration) if not match: return None, None - value, raw_unit = match.groups() - unit = _DURATION_UNIT_ALIASES.get(raw_unit) - if unit is None: - return None, None + value, unit = match.groups() return int(value), unit