From 457a0c302450aef8c17c3439d12ad161ec9b6a90 Mon Sep 17 00:00:00 2001 From: derhornspieler <15236687+derhornspieler@users.noreply.github.com> Date: Tue, 25 Aug 2026 23:39:32 -0400 Subject: [PATCH] fix(router): type the params mapping spread into LiteLLM_Params _create_deployment merges its untyped params dict with the zeroed PTU pricing mapping and spreads the result into LiteLLM_Params. The merge widens every value to Unknown | float | tuple[()] | Mapping[str, float], and because a spread is checked against each field in turn, basedpyright raised one error per field: 183 on that one line. This branch adds eighteen anthropic federation fields to that model, so it inherited eighteen more errors on a line it does not touch, which is the whole of the reportArgumentType budget breach. The same effect landed two more in the azure passthrough transformation. Naming the merged value as the heterogeneous config mapping it is fixes the line rather than the symptom. LiteLLM_Params still validates every field at runtime, so nothing is loosened that was previously enforced. The file drops from 402 of these errors to 237, which puts the rule below its base count instead of over its ceiling. --- litellm/router.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/litellm/router.py b/litellm/router.py index de60d46e01d..22238996148 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -8156,13 +8156,10 @@ class Router: if ptu_error is not None and is_ptu_cost_attribution_enabled(): raise ValueError(ptu_error) zeroed_pricing: Final = zeroed_ptu_pricing(_model_info, _litellm_params) if config_sourced else None - litellm_params: Final[LiteLLM_Params] = LiteLLM_Params( - **( - _litellm_params - if zeroed_pricing is None - else MappingProxyType({**_litellm_params, **zeroed_pricing}) - ) + merged_params: Final[Mapping[str, Any]] = ( + _litellm_params if zeroed_pricing is None else MappingProxyType({**_litellm_params, **zeroed_pricing}) ) + litellm_params: Final[LiteLLM_Params] = LiteLLM_Params(**merged_params) warn_on_provider_credential_mismatch(model_name=_model_name, litellm_params=_litellm_params) deployment = Deployment( **deployment_info,