From 104f22516416371ddb9f4a4ff797191f5cc5277a Mon Sep 17 00:00:00 2001 From: Lalith Vardhan Date: Tue, 27 Oct 2026 09:49:53 -0700 Subject: [PATCH] fix(router): give the _text_completion model_name cast a cast-ok reason (LIT006 gate) --- litellm/router.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/router.py b/litellm/router.py index 039729dee80..dc673cd5bb3 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -5749,7 +5749,9 @@ class Router: self._update_kwargs_with_deployment(deployment=deployment, kwargs=kwargs) data: Final = deployment["litellm_params"] # not mutated; the call below merges into a new dict - model_name = cast(str, data["model"]) # rebind-ok: assigned inside try so except can attribute the failure + model_name = cast( # cast-ok: deployment params hold a str model # rebind-ok: set in try, read in except + str, data["model"] + ) self.total_calls[model_name] += 1 ### DEPLOYMENT-SPECIFIC PRE-CALL CHECKS ### (e.g. update rpm pre-call. Raise error, if deployment over limit)