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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Add new gemini preview models + Fix cohere v2 embedding 'embedding_types' param mapping (#10991)
Krish Dholakiaf0c825466582
diff --git a/litellm/llms/cohere/embed/transformation.py b/litellm/llms/cohere/embed/transformation.pyindex 03d7edd1262..b5b350a952c 100644--- a/litellm/llms/cohere/embed/transformation.py+++ b/litellm/llms/cohere/embed/transformation.py@@ -50,7 +50,10 @@ class CohereEmbeddingConfig(BaseEmbeddingConfig):) -> dict:for k, v in non_default_params.items():if k == "encoding_format":- optional_params["embedding_types"] = v+ if isinstance(v, list):+ optional_params["embedding_types"] = v+ else:+ optional_params["embedding_types"] = [v]elif k == "dimensions":optional_params["output_dimension"] = vreturn optional_paramsdiff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex a1fd7f7366b..152fd8777f2 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -5870,6 +5870,36 @@"supported_output_modalities": ["text"],"source": "https://cloud.google.com/vertex-ai/generative-ai/pricing"},+ "gemini/gemini-2.5-flash-preview-05-20": {+ "max_tokens": 65535,+ "max_input_tokens": 1048576,+ "max_output_tokens": 65535,+ "max_images_per_prompt": 3000,+ "max_videos_per_prompt": 10,+ "max_video_length": 1,+ "max_audio_length_hours": 8.4,+ "max_audio_per_prompt": 1,+ "max_pdf_size_mb": 30,+ "input_cost_per_audio_token": 1e-6,+ "input_cost_per_token": 0.15e-6,+ "output_cost_per_token": 0.6e-6,+ "output_cost_per_reasoning_token": 3.5e-6,+ "litellm_provider": "gemini",+ "mode": "chat",+ "rpm": 10,+ "tpm": 250000,+ "supports_system_messages": true,+ "supports_function_calling": true,+ "supports_vision": true,+ "supports_reasoning": true,+ "supports_response_schema": true,+ "supports_audio_output": false,+ "supports_tool_choice": true,+ "supported_endpoints": ["/v1/chat/completions", "/v1/completions"],+ "supported_modalities": ["text", "image", "audio", "video"],+ "supported_output_modalities": ["text"],+ "source": "https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-preview"+ },"gemini/gemini-2.5-flash-preview-04-17": {"max_tokens": 65535,"max_input_tokens": 1048576,@@ -5900,6 +5930,34 @@"supported_output_modalities": ["text"],"source": "https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-preview"},+ "gemini-2.5-flash-preview-05-20": {+ "max_tokens": 65535,+ "max_input_tokens": 1048576,+ "max_output_tokens": 65535,+ "max_images_per_prompt": 3000,+ "max_videos_per_prompt": 10,+ "max_video_length": 1,+ "max_audio_length_hours": 8.4,+ "max_audio_per_prompt": 1,+ "max_pdf_size_mb": 30,+ "input_cost_per_audio_token": 1e-6,+ "input_cost_per_token": 0.15e-6,+ "output_cost_per_token": 0.6e-6,+ "output_cost_per_reasoning_token": 3.5e-6,+ "litellm_provider": "vertex_ai-language-models",+ "mode": "chat",+ "supports_reasoning": true,+ "supports_system_messages": true,+ "supports_function_calling": true,+ "supports_vision": true,+ "supports_response_schema": true,+ "supports_audio_output": false,+ "supports_tool_choice": true,+ "supported_endpoints": ["/v1/chat/completions", "/v1/completions", "/v1/batch"],+ "supported_modalities": ["text", "image", "audio", "video"],+ "supported_output_modalities": ["text"],+ "source": "https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-preview"+ },"gemini-2.5-flash-preview-04-17": {"max_tokens": 65535,"max_input_tokens": 1048576,diff --git a/litellm/proxy/guardrails/guardrail_hooks/aim.py b/litellm/proxy/guardrails/guardrail_hooks/aim.pyindex 0409068afc4..66a0aff6cb0 100644--- a/litellm/proxy/guardrails/guardrail_hooks/aim.py+++ b/litellm/proxy/guardrails/guardrail_hooks/aim.py@@ -14,8 +14,8 @@ from pydantic import BaseModelfrom websockets.asyncio.client import ClientConnection, connectfrom litellm import DualCache-from litellm._version import version as litellm_versionfrom litellm._logging import verbose_proxy_logger+from litellm._version import version as litellm_versionfrom litellm.integrations.custom_guardrail import CustomGuardrailfrom litellm.llms.custom_httpx.http_handler import (get_async_httpx_client,@@ -125,17 +125,16 @@ class AimGuardrail(CustomGuardrail):if action_type is None:verbose_proxy_logger.debug("Aim: No required action specified")return data- match action_type:- case "monitor_action":- verbose_proxy_logger.info("Aim: monitor action")- case "block_action":- self._handle_block_action(res["analysis_result"], required_action)- case "anonymize_action":- return self._anonymize_request(- res["analysis_result"], required_action, data- )- case _:- verbose_proxy_logger.error(f"Aim: {action_type} action")+ if action_type == "monitor_action":+ verbose_proxy_logger.info("Aim: monitor action")+ elif action_type == "block_action":+ self._handle_block_action(res["analysis_result"], required_action)+ elif action_type == "anonymize_action":+ return self._anonymize_request(+ res["analysis_result"], required_action, data+ )+ else:+ verbose_proxy_logger.error(f"Aim: {action_type} action")return datadef _handle_block_action(self, analysis_result: Any, required_action: Any) -> None:diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex a1fd7f7366b..152fd8777f2 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -5870,6 +5870,36 @@"supported_output_modalities": ["text"],"source": "https://cloud.google.com/vertex-ai/generative-ai/pricing"},+ "gemini/gemini-2.5-flash-preview-05-20": {+ "max_tokens": 65535,+ "max_input_tokens": 1048576,+ "max_output_tokens": 65535,+ "max_images_per_prompt": 3000,+ "max_videos_per_prompt": 10,+ "max_video_length": 1,+ "max_audio_length_hours": 8.4,+ "max_audio_per_prompt": 1,+ "max_pdf_size_mb": 30,+ "input_cost_per_audio_token": 1e-6,+ "input_cost_per_token": 0.15e-6,+ "output_cost_per_token": 0.6e-6,+ "output_cost_per_reasoning_token": 3.5e-6,+ "litellm_provider": "gemini",+ "mode": "chat",+ "rpm": 10,+ "tpm": 250000,+ "supports_system_messages": true,+ "supports_function_calling": true,+ "supports_vision": true,+ "supports_reasoning": true,+ "supports_response_schema": true,+ "supports_audio_output": false,+ "supports_tool_choice": true,+ "supported_endpoints": ["/v1/chat/completions", "/v1/completions"],+ "supported_modalities": ["text", "image", "audio", "video"],+ "supported_output_modalities": ["text"],+ "source": "https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-preview"+ },"gemini/gemini-2.5-flash-preview-04-17": {"max_tokens": 65535,"max_input_tokens": 1048576,@@ -5900,6 +5930,34 @@"supported_output_modalities": ["text"],"source": "https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-preview"},+ "gemini-2.5-flash-preview-05-20": {+ "max_tokens": 65535,+ "max_input_tokens": 1048576,+ "max_output_tokens": 65535,+ "max_images_per_prompt": 3000,+ "max_videos_per_prompt": 10,+ "max_video_length": 1,+ "max_audio_length_hours": 8.4,+ "max_audio_per_prompt": 1,+ "max_pdf_size_mb": 30,+ "input_cost_per_audio_token": 1e-6,+ "input_cost_per_token": 0.15e-6,+ "output_cost_per_token": 0.6e-6,+ "output_cost_per_reasoning_token": 3.5e-6,+ "litellm_provider": "vertex_ai-language-models",+ "mode": "chat",+ "supports_reasoning": true,+ "supports_system_messages": true,+ "supports_function_calling": true,+ "supports_vision": true,+ "supports_response_schema": true,+ "supports_audio_output": false,+ "supports_tool_choice": true,+ "supported_endpoints": ["/v1/chat/completions", "/v1/completions", "/v1/batch"],+ "supported_modalities": ["text", "image", "audio", "video"],+ "supported_output_modalities": ["text"],+ "source": "https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-preview"+ },"gemini-2.5-flash-preview-04-17": {"max_tokens": 65535,"max_input_tokens": 1048576,diff --git a/tests/llm_translation/test_optional_params.py b/tests/llm_translation/test_optional_params.pyindex d1d10d50643..b29d20ba408 100644--- a/tests/llm_translation/test_optional_params.py+++ b/tests/llm_translation/test_optional_params.py@@ -1459,3 +1459,11 @@ def test_azure_response_format(monkeypatch):response_format={"type": "json_object"},)assert optional_params["response_format"] == {"type": "json_object"}++def test_cohere_embed_dimensions_param():+ optional_params = get_optional_params_embeddings(+ model="embed-multilingual-v3.0",+ custom_llm_provider="cohere",+ encoding_format="float",+ )+ assert optional_params["embedding_types"] == ["float"]\ No newline at end of file