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(vertex_ai_partner.py): add /chat/completion codestral support

Krrish Dholakia6e163d3c8a59
diff --git a/litellm/llms/vertex_ai_partner.py b/litellm/llms/vertex_ai_partner.py
index eb24c4d2658..76420291739 100644
--- a/litellm/llms/vertex_ai_partner.py
+++ b/litellm/llms/vertex_ai_partner.py
@@ -192,7 +192,7 @@ class VertexAIPartnerModels(BaseLLM):
if "llama" in model:
partner = "llama"
- elif "mistral" in model:
+ elif "mistral" in model or "codestral" in model:
partner = "mistralai"
optional_params["custom_endpoint"] = True
diff --git a/litellm/main.py b/litellm/main.py
index bb8a1305e36..5ba8439caac 100644
--- a/litellm/main.py
+++ b/litellm/main.py
@@ -2074,7 +2074,11 @@ def completion(
timeout=timeout,
client=client,
)
- elif model.startswith("meta/") or model.startswith("mistral"):
+ elif (
+ model.startswith("meta/")
+ or model.startswith("mistral")
+ or model.startswith("codestral")
+ ):
model_response = vertex_partner_models_chat_completion.completion(
model=model,
messages=messages,
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index 91fd044cebd..380771c668a 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -2092,6 +2092,16 @@
"mode": "chat",
"supports_function_calling": true
},
+ "vertex_ai/codestral@latest": {
+ "max_tokens": 128000,
+ "max_input_tokens": 128000,
+ "max_output_tokens": 128000,
+ "input_cost_per_token": 0.000001,
+ "output_cost_per_token": 0.000003,
+ "litellm_provider": "vertex_ai-mistral_models",
+ "mode": "chat",
+ "supports_function_calling": true
+ },
"vertex_ai/codestral@2405": {
"max_tokens": 128000,
"max_input_tokens": 128000,
diff --git a/litellm/tests/test_amazing_vertex_completion.py b/litellm/tests/test_amazing_vertex_completion.py
index 438997b3833..f0b243c36eb 100644
--- a/litellm/tests/test_amazing_vertex_completion.py
+++ b/litellm/tests/test_amazing_vertex_completion.py
@@ -903,9 +903,10 @@ from litellm.tests.test_completion import response_format_tests
@pytest.mark.parametrize(
"model",
[
- "vertex_ai/mistral-large@2407",
- "vertex_ai/mistral-nemo@2407",
- "vertex_ai/meta/llama3-405b-instruct-maas",
+ # "vertex_ai/mistral-large@2407",
+ # "vertex_ai/mistral-nemo@2407",
+ "vertex_ai/codestral@2405",
+ # "vertex_ai/meta/llama3-405b-instruct-maas",
], #
) # "vertex_ai",
@pytest.mark.parametrize(
diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json
index 91fd044cebd..380771c668a 100644
--- a/model_prices_and_context_window.json
+++ b/model_prices_and_context_window.json
@@ -2092,6 +2092,16 @@
"mode": "chat",
"supports_function_calling": true
},
+ "vertex_ai/codestral@latest": {
+ "max_tokens": 128000,
+ "max_input_tokens": 128000,
+ "max_output_tokens": 128000,
+ "input_cost_per_token": 0.000001,
+ "output_cost_per_token": 0.000003,
+ "litellm_provider": "vertex_ai-mistral_models",
+ "mode": "chat",
+ "supports_function_calling": true
+ },
"vertex_ai/codestral@2405": {
"max_tokens": 128000,
"max_input_tokens": 128000,