From e0995bb61a8c3ab9aa2bf11410fb964fc1997b79 Mon Sep 17 00:00:00 2001 From: factnn <166481866+factnn@users.noreply.github.com> Date: Sat, 27 Jun 2026 22:13:59 +0800 Subject: [PATCH] fix: read adaptive_router cost from model_info when not in litellm_params --- litellm/router.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/litellm/router.py b/litellm/router.py index f408d030b8b..d111e94a17b 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -7685,8 +7685,12 @@ class Router: # `input_cost_per_token` is a LiteLLM_Params field per types/router.py. lp = d.get("litellm_params") if isinstance(d, dict) else d.litellm_params - lp_dict: Dict[str, Any] = lp if isinstance(lp, dict) else (lp.model_dump() if lp else {}) + lp_dict: Dict[str, Any] = ( + lp if isinstance(lp, dict) else (lp.model_dump() if lp else {}) + ) cost = lp_dict.get("input_cost_per_token") + if cost is None: + cost = mi_dict.get("input_cost_per_token") if cost is not None: model_to_cost[name] = float(cost)