Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: address Greptile review feedback

Chesarsb00e507574ef
diff --git a/litellm/litellm_core_utils/get_model_cost_map.py b/litellm/litellm_core_utils/get_model_cost_map.py
index 0aabedae603..406702503ef 100644
--- a/litellm/litellm_core_utils/get_model_cost_map.py
+++ b/litellm/litellm_core_utils/get_model_cost_map.py
@@ -199,9 +199,11 @@ def _expand_model_aliases(model_cost: dict) -> dict:
for model_name, model_info in model_cost.items():
aliases: Optional[list] = model_info.get("aliases")
- if not aliases:
+ if aliases is None:
continue
keys_with_aliases.append(model_name)
+ if not aliases:
+ continue
for alias in aliases:
if alias in model_cost:
verbose_logger.warning(
diff --git a/tests/test_litellm/test_model_cost_aliases.py b/tests/test_litellm/test_model_cost_aliases.py
index 29a37ed54d7..c6702ab13e4 100644
--- a/tests/test_litellm/test_model_cost_aliases.py
+++ b/tests/test_litellm/test_model_cost_aliases.py
@@ -148,7 +148,7 @@ class TestAliasConflicts:
# The canonical "model-dated" entry is preserved, not overwritten
assert "model-dated" in result
- assert "alias conflict" in caplog.text.lower() or len(result) == 2
+ assert "alias conflict" in caplog.text.lower()
def test_duplicate_alias_across_entries(self, caplog):
"""Same alias claimed by two different entries: second one is skipped."""