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]

Merge branch 'main' into litellm_track_imagen_spend_logs

Ishaan Jaffc1adb0b7f228
diff --cc litellm/__init__.py
index 4148fdc78cc,e220c899208..ffaf1a2bec0
--- a/litellm/__init__.py
+++ b/litellm/__init__.py
@@@ -415,11 -416,11 +417,14 @@@ for key, value in model_cost.items()
elif value.get("litellm_provider") == "vertex_ai-ai21_models":
key = key.replace("vertex_ai/", "")
vertex_ai_ai21_models.append(key)
+ elif value.get("litellm_provider") == "vertex_ai-image-models":
+ key = key.replace("vertex_ai/", "")
+ vertex_ai_image_models.append(key)
elif value.get("litellm_provider") == "ai21":
- ai21_models.append(key)
+ if value.get("mode") == "chat":
+ ai21_chat_models.append(key)
+ else:
+ ai21_models.append(key)
elif value.get("litellm_provider") == "nlp_cloud":
nlp_cloud_models.append(key)
elif value.get("litellm_provider") == "aleph_alpha":
diff --cc litellm/tests/test_get_llm_provider.py
index 8f585a0720b,ebf4debd5bc..942b9c8244c
--- a/litellm/tests/test_get_llm_provider.py
+++ b/litellm/tests/test_get_llm_provider.py
@@@ -70,8 -70,26 +70,33 @@@ def test_get_llm_provider_deepseek_cust
os.environ.pop("DEEPSEEK_API_BASE")
+def test_get_llm_provider_vertex_ai_image_models():
+ model, custom_llm_provider, dynamic_api_key, api_base = litellm.get_llm_provider(
+ model="imagegeneration@006", custom_llm_provider=None
+ )
+ assert custom_llm_provider == "vertex_ai"
++
+ def test_get_llm_provider_ai21_chat():
+ model, custom_llm_provider, dynamic_api_key, api_base = litellm.get_llm_provider(
+ model="jamba-1.5-large",
+ )
+ assert custom_llm_provider == "ai21_chat"
+ assert model == "jamba-1.5-large"
+ assert api_base == "https://api.ai21.com/studio/v1"
+
+
+ def test_get_llm_provider_ai21_chat_test2():
+ """
+ if user prefix with ai21/ but calls jamba-1.5-large then it should be ai21_chat provider
+ """
+ model, custom_llm_provider, dynamic_api_key, api_base = litellm.get_llm_provider(
+ model="ai21/jamba-1.5-large",
+ )
+
+ print("model=", model)
+ print("custom_llm_provider=", custom_llm_provider)
+ print("api_base=", api_base)
+ assert custom_llm_provider == "ai21_chat"
+ assert model == "jamba-1.5-large"
+ assert api_base == "https://api.ai21.com/studio/v1"
++