From 77496776c15aa29dbca670288fd581f8cbe17b95 Mon Sep 17 00:00:00 2001 From: Chesars Date: Fri, 27 Feb 2026 18:48:28 -0300 Subject: [PATCH] fix(register_model): align membership check with stored value for openrouter models The guard checked `key` (full key like "openrouter/gpt-4") but the set stores `split_string[-1]` ("gpt-4"), so the duplicate check never matched. --- litellm/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index 7576e3bb83d..2e186bb160f 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -2779,7 +2779,7 @@ def register_model(model_cost: Union[str, dict]): # noqa: PLR0915 litellm.anthropic_models.add(key) elif value.get("litellm_provider") == "openrouter": split_string = key.split("/", 1) - if key not in litellm.openrouter_models: + if split_string[-1] not in litellm.openrouter_models: litellm.openrouter_models.add(split_string[-1]) elif value.get("litellm_provider") == "vercel_ai_gateway": if key not in litellm.vercel_ai_gateway_models: