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.
This commit is contained in:
Chesars 2026-02-27 18:48:28 -03:00
parent bf3e6bb9f4
commit 77496776c1

View file

@ -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: