From 9dc23c7e3ae489b2e94a20e5b07e920aa68f036a Mon Sep 17 00:00:00 2001 From: Mihidum Hettiyahandi <55163074+mihidumh@users.noreply.github.com> Date: Wed, 15 Jul 2026 09:32:05 +1000 Subject: [PATCH] fix(router): use consistent positive checks in azure base_model fallback gate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review follow-up: token-limit fields used 'is not None' while the cost field used '> 0' — a cost-map entry explicitly storing 0 limits could suppress the error log without carrying usable resolution data. All three checks now require a positive value. --- litellm/router.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/router.py b/litellm/router.py index 67a16c16885..6d7a388fc20 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -8535,8 +8535,8 @@ class Router: _azure_fallback_key = _model if _model.startswith("azure/") else "azure/{}".format(_model) _fallback_entry = litellm.model_cost.get(_azure_fallback_key) or {} _fallback_resolves = ( - _fallback_entry.get("max_input_tokens") is not None - or _fallback_entry.get("max_tokens") is not None + (_fallback_entry.get("max_input_tokens") or 0) > 0 + or (_fallback_entry.get("max_tokens") or 0) > 0 or (_fallback_entry.get("input_cost_per_token") or 0) > 0 ) if _fallback_resolves: