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
feat: Add Lambda AI provider support (#12817)
Cole McIntosh41436fefa074
diff --git a/docs/my-website/docs/providers/lambda_ai.md b/docs/my-website/docs/providers/lambda_ai.mdnew file mode 100644index 00000000000..91800faab70--- /dev/null+++ b/docs/my-website/docs/providers/lambda_ai.md@@ -0,0 +1,280 @@+import Tabs from '@theme/Tabs';+import TabItem from '@theme/TabItem';++# Lambda AI++## Overview++| Property | Details |+|-------|-------|+| Description | Lambda AI provides access to a wide range of open-source language models through their cloud GPU infrastructure, optimized for inference at scale. |+| Provider Route on LiteLLM | `lambda_ai/` |+| Link to Provider Doc | [Lambda AI API Documentation ↗](https://docs.lambda.ai/api) |+| Base URL | `https://api.lambda.ai/v1` |+| Supported Operations | [`/chat/completions`](#sample-usage) |++<br />+<br />++https://docs.lambda.ai/api++**We support ALL Lambda AI models, just set `lambda_ai/` as a prefix when sending completion requests**++## Available Models++Lambda AI offers a diverse selection of state-of-the-art open-source models:++### Large Language Models++| Model | Description | Context Window |+|-------|-------------|----------------|+| `lambda_ai/llama3.3-70b-instruct-fp8` | Llama 3.3 70B with FP8 quantization | 8,192 tokens |+| `lambda_ai/llama3.1-405b-instruct-fp8` | Llama 3.1 405B with FP8 quantization | 8,192 tokens |+| `lambda_ai/llama3.1-70b-instruct-fp8` | Llama 3.1 70B with FP8 quantization | 8,192 tokens |+| `lambda_ai/llama3.1-8b-instruct` | Llama 3.1 8B instruction-tuned | 8,192 tokens |+| `lambda_ai/llama3.1-nemotron-70b-instruct-fp8` | Llama 3.1 Nemotron 70B | 8,192 tokens |++### DeepSeek Models++| Model | Description | Context Window |+|-------|-------------|----------------|+| `lambda_ai/deepseek-llama3.3-70b` | DeepSeek Llama 3.3 70B | 8,192 tokens |+| `lambda_ai/deepseek-r1-0528` | DeepSeek R1 0528 | 8,192 tokens |+| `lambda_ai/deepseek-r1-671b` | DeepSeek R1 671B | 8,192 tokens |+| `lambda_ai/deepseek-v3-0324` | DeepSeek V3 0324 | 8,192 tokens |++### Hermes Models++| Model | Description | Context Window |+|-------|-------------|----------------|+| `lambda_ai/hermes3-405b` | Hermes 3 405B | 8,192 tokens |+| `lambda_ai/hermes3-70b` | Hermes 3 70B | 8,192 tokens |+| `lambda_ai/hermes3-8b` | Hermes 3 8B | 8,192 tokens |++### Coding Models++| Model | Description | Context Window |+|-------|-------------|----------------|+| `lambda_ai/qwen25-coder-32b-instruct` | Qwen 2.5 Coder 32B | 8,192 tokens |+| `lambda_ai/qwen3-32b-fp8` | Qwen 3 32B with FP8 | 8,192 tokens |++### Vision Models++| Model | Description | Context Window |+|-------|-------------|----------------|+| `lambda_ai/llama3.2-11b-vision-instruct` | Llama 3.2 11B with vision capabilities | 8,192 tokens |++### Specialized Models++| Model | Description | Context Window |+|-------|-------------|----------------|+| `lambda_ai/llama-4-maverick-17b-128e-instruct-fp8` | Llama 4 Maverick with 128k context | 131,072 tokens |+| `lambda_ai/llama-4-scout-17b-16e-instruct` | Llama 4 Scout with 16k context | 16,384 tokens |+| `lambda_ai/lfm-40b` | LFM 40B model | 8,192 tokens |+| `lambda_ai/lfm-7b` | LFM 7B model | 8,192 tokens |++## Required Variables++```python showLineNumbers title="Environment Variables"+os.environ["LAMBDA_API_KEY"] = "" # your Lambda AI API key+```++## Usage - LiteLLM Python SDK++### Non-streaming++```python showLineNumbers title="Lambda AI Non-streaming Completion"+import os+import litellm+from litellm import completion++os.environ["LAMBDA_API_KEY"] = "" # your Lambda AI API key++messages = [{"content": "Hello, how are you?", "role": "user"}]++# Lambda AI call+response = completion(+ model="lambda_ai/llama3.1-8b-instruct",+ messages=messages+)++print(response)+```++### Streaming++```python showLineNumbers title="Lambda AI Streaming Completion"+import os+import litellm+from litellm import completion++os.environ["LAMBDA_API_KEY"] = "" # your Lambda AI API key++messages = [{"content": "Write a short story about AI", "role": "user"}]++# Lambda AI call with streaming+response = completion(+ model="lambda_ai/llama3.1-70b-instruct-fp8",+ messages=messages,+ stream=True+)++for chunk in response:+ print(chunk)+```++### Vision/Multimodal Support++The Llama 3.2 Vision model supports image inputs:++```python showLineNumbers title="Lambda AI Vision/Multimodal"+import os+import litellm+from litellm import completion++os.environ["LAMBDA_API_KEY"] = "" # your Lambda AI API key++messages = [{+ "role": "user",+ "content": [+ {+ "type": "text",+ "text": "What's in this image?"+ },+ {+ "type": "image_url",+ "image_url": {+ "url": "https://example.com/image.jpg"+ }+ }+ ]+}]++# Lambda AI vision model call+response = completion(+ model="lambda_ai/llama3.2-11b-vision-instruct",+ messages=messages+)++print(response)+```++### Function Calling++Lambda AI models support function calling:++```python showLineNumbers title="Lambda AI Function Calling"+import os+import litellm+from litellm import completion++os.environ["LAMBDA_API_KEY"] = "" # your Lambda AI API key++# Define tools+tools = [{+ "type": "function",+ "function": {+ "name": "get_weather",+ "description": "Get the current weather in a location",+ "parameters": {+ "type": "object",+ "properties": {+ "location": {+ "type": "string",+ "description": "The city and state, e.g. San Francisco, CA"+ }+ },+ "required": ["location"]+ }+ }+}]++messages = [{"role": "user", "content": "What's the weather in Boston?"}]++# Lambda AI call with function calling+response = completion(+ model="lambda_ai/hermes3-70b",+ messages=messages,+ tools=tools,+ tool_choice="auto"+)++print(response)+```++## Usage - LiteLLM Proxy Server++```yaml showLineNumbers title="config.yaml"+model_list:+ - model_name: llama-8b+ litellm_params:+ model: lambda_ai/llama3.1-8b-instruct+ api_key: os.environ/LAMBDA_API_KEY+ - model_name: deepseek-70b+ litellm_params:+ model: lambda_ai/deepseek-llama3.3-70b+ api_key: os.environ/LAMBDA_API_KEY+ - model_name: hermes-405b+ litellm_params:+ model: lambda_ai/hermes3-405b+ api_key: os.environ/LAMBDA_API_KEY+ - model_name: qwen-coder+ litellm_params:+ model: lambda_ai/qwen25-coder-32b-instruct+ api_key: os.environ/LAMBDA_API_KEY+```++## Custom API Base++If you need to use a custom API base URL:++```python showLineNumbers title="Custom API Base"+import os+import litellm+from litellm import completion++# Using environment variable+os.environ["LAMBDA_API_BASE"] = "https://custom.lambda-api.com/v1"+os.environ["LAMBDA_API_KEY"] = "" # your API key++# Or pass directly+response = completion(+ model="lambda_ai/llama3.1-8b-instruct",+ messages=[{"content": "Hello!", "role": "user"}],+ api_base="https://custom.lambda-api.com/v1",+ api_key="your-api-key"+)+```++## Supported OpenAI Parameters++Lambda AI supports all standard OpenAI parameters since it's fully OpenAI-compatible:++- `temperature`+- `max_tokens`+- `top_p`+- `frequency_penalty`+- `presence_penalty`+- `stop`+- `n`+- `stream`+- `tools`+- `tool_choice`+- `response_format`+- `seed`+- `user`+- `logit_bias`++Example with parameters:++```python showLineNumbers title="Lambda AI with Parameters"+response = completion(+ model="lambda_ai/hermes3-405b",+ messages=[{"content": "Explain quantum computing", "role": "user"}],+ temperature=0.7,+ max_tokens=500,+ top_p=0.9,+ frequency_penalty=0.2,+ presence_penalty=0.1+)+```\ No newline at end of filediff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.jsindex b605da829cf..b770ac625a0 100644--- a/docs/my-website/sidebars.js+++ b/docs/my-website/sidebars.js@@ -447,6 +447,7 @@ const sidebars = {"providers/replicate","providers/togetherai","providers/v0",+ "providers/lambda_ai","providers/novita","providers/voyage","providers/jina_ai",diff --git a/litellm/__init__.py b/litellm/__init__.pyindex 99a5454ace4..db77eca6c39 100644--- a/litellm/__init__.py+++ b/litellm/__init__.py@@ -503,6 +503,7 @@ elevenlabs_models: List = []dashscope_models: List = []moonshot_models: List = []v0_models: List = []+lambda_ai_models: List = []def is_bedrock_pricing_only_model(key: str) -> bool:"""@@ -683,6 +684,8 @@ def add_known_models():moonshot_models.append(key)elif value.get("litellm_provider") == "v0":v0_models.append(key)+ elif value.get("litellm_provider") == "lambda_ai":+ lambda_ai_models.append(key)add_known_models()@@ -768,6 +771,7 @@ model_list = (+ dashscope_models+ moonshot_models+ v0_models+ + lambda_ai_models)model_list_set = set(model_list)@@ -836,6 +840,7 @@ models_by_provider: dict = {"dashscope": dashscope_models,"moonshot": moonshot_models,"v0": v0_models,+ "lambda_ai": lambda_ai_models,}# mapping for those models which have larger equivalents@@ -1156,6 +1161,7 @@ from .llms.nebius.chat.transformation import NebiusConfigfrom .llms.dashscope.chat.transformation import DashScopeChatConfigfrom .llms.moonshot.chat.transformation import MoonshotChatConfigfrom .llms.v0.chat.transformation import V0ChatConfig+from .llms.lambda_ai.chat.transformation import LambdaAIChatConfigfrom .main import * # type: ignorefrom .integrations import *from .llms.custom_httpx.async_client_cleanup import close_litellm_async_clientsdiff --git a/litellm/constants.py b/litellm/constants.pyindex afdd95385cb..d7d38748822 100644--- a/litellm/constants.py+++ b/litellm/constants.py@@ -279,6 +279,7 @@ LITELLM_CHAT_PROVIDERS = ["dashscope","moonshot","v0",+ "lambda_ai",]LITELLM_EMBEDDING_PROVIDERS_SUPPORTING_INPUT_ARRAY_OF_TOKENS = [@@ -408,6 +409,7 @@ openai_compatible_endpoints: List = ["https://dashscope-intl.aliyuncs.com/compatible-mode/v1","https://api.moonshot.ai/v1","https://api.v0.dev/v1",+ "https://api.lambda.ai/v1",]@@ -446,6 +448,7 @@ openai_compatible_providers: List = ["dashscope","moonshot","v0",+ "lambda_ai",]openai_text_completion_compatible_providers: List = ([ # providers that support `/v1/completions`@@ -458,6 +461,8 @@ openai_text_completion_compatible_providers: List = ("nebius","dashscope","moonshot",+ "v0",+ "lambda_ai",])_openai_like_providers: List = [diff --git a/litellm/litellm_core_utils/get_llm_provider_logic.py b/litellm/litellm_core_utils/get_llm_provider_logic.pyindex 84c25d49323..2b5ee4b18c8 100644--- a/litellm/litellm_core_utils/get_llm_provider_logic.py+++ b/litellm/litellm_core_utils/get_llm_provider_logic.py@@ -240,6 +240,9 @@ def get_llm_provider( # noqa: PLR0915elif endpoint == "https://api.v0.dev/v1":custom_llm_provider = "v0"dynamic_api_key = get_secret_str("V0_API_KEY")+ elif endpoint == "https://api.lambda.ai/v1":+ custom_llm_provider = "lambda_ai"+ dynamic_api_key = get_secret_str("LAMBDA_API_KEY")if api_base is not None and not isinstance(api_base, str):raise Exception(@@ -691,6 +694,13 @@ def _get_openai_compatible_provider_info( # noqa: PLR0915) = litellm.V0ChatConfig()._get_openai_compatible_provider_info(api_base, api_key)+ elif custom_llm_provider == "lambda_ai":+ (+ api_base,+ dynamic_api_key,+ ) = litellm.LambdaAIChatConfig()._get_openai_compatible_provider_info(+ api_base, api_key+ )if api_base is not None and not isinstance(api_base, str):raise Exception("api base needs to be a string. api_base={}".format(api_base))diff --git a/litellm/llms/lambda_ai/__init__.py b/litellm/llms/lambda_ai/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/litellm/llms/lambda_ai/chat/__init__.py b/litellm/llms/lambda_ai/chat/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/litellm/llms/lambda_ai/chat/transformation.py b/litellm/llms/lambda_ai/chat/transformation.pynew file mode 100644index 00000000000..2d481d66824--- /dev/null+++ b/litellm/llms/lambda_ai/chat/transformation.py@@ -0,0 +1,31 @@+"""+Translate from OpenAI's `/v1/chat/completions` to Lambda's `/v1/chat/completions`+"""++from typing import Optional, Tuple++from litellm.secret_managers.main import get_secret_str++from ...openai_like.chat.transformation import OpenAILikeChatConfig+++class LambdaAIChatConfig(OpenAILikeChatConfig):+ """+ Lambda AI is OpenAI-compatible with standard endpoints+ """++ @property+ def custom_llm_provider(self) -> Optional[str]:+ return "lambda_ai"++ def _get_openai_compatible_provider_info(+ self, api_base: Optional[str], api_key: Optional[str]+ ) -> Tuple[Optional[str], Optional[str]]:+ # Lambda AI is openai compatible, we just need to set the api_base+ api_base = (+ api_base+ or get_secret_str("LAMBDA_API_BASE")+ or "https://api.lambda.ai/v1" # Default Lambda API base URL+ ) # type: ignore+ dynamic_api_key = api_key or get_secret_str("LAMBDA_API_KEY")+ return api_base, dynamic_api_key\ No newline at end of filediff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 58ec3df9328..f869bd42378 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -14780,6 +14780,267 @@"supports_system_messages": true,"supports_tool_choice": true},+ "lambda_ai/deepseek-llama3.3-70b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2e-07,+ "output_cost_per_token": 6e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/deepseek-r1-0528": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2e-07,+ "output_cost_per_token": 6e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/deepseek-r1-671b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 8e-07,+ "output_cost_per_token": 8e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/deepseek-v3-0324": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2e-07,+ "output_cost_per_token": 6e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/hermes3-405b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 8e-07,+ "output_cost_per_token": 8e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/hermes3-70b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.2e-07,+ "output_cost_per_token": 3e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/hermes3-8b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2.5e-08,+ "output_cost_per_token": 4e-08,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/lfm-40b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1e-07,+ "output_cost_per_token": 2e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/lfm-7b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2.5e-08,+ "output_cost_per_token": 4e-08,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama-4-maverick-17b-128e-instruct-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 8192,+ "input_cost_per_token": 5e-08,+ "output_cost_per_token": 1e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama-4-scout-17b-16e-instruct": {+ "max_tokens": 16384,+ "max_input_tokens": 16384,+ "max_output_tokens": 8192,+ "input_cost_per_token": 5e-08,+ "output_cost_per_token": 1e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.1-405b-instruct-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 8e-07,+ "output_cost_per_token": 8e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.1-70b-instruct-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.2e-07,+ "output_cost_per_token": 3e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.1-8b-instruct": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2.5e-08,+ "output_cost_per_token": 4e-08,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.1-nemotron-70b-instruct-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.2e-07,+ "output_cost_per_token": 3e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.2-11b-vision-instruct": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.5e-08,+ "output_cost_per_token": 2.5e-08,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_vision": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.2-3b-instruct": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.5e-08,+ "output_cost_per_token": 2.5e-08,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.3-70b-instruct-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.2e-07,+ "output_cost_per_token": 3e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/qwen25-coder-32b-instruct": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 5e-08,+ "output_cost_per_token": 1e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/qwen3-32b-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 5e-08,+ "output_cost_per_token": 1e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },"voyage/voyage-01": {"max_tokens": 4096,"max_input_tokens": 4096,diff --git a/litellm/types/utils.py b/litellm/types/utils.pyindex 5ff17bd3378..eba8f65c379 100644--- a/litellm/types/utils.py+++ b/litellm/types/utils.py@@ -2276,6 +2276,7 @@ class LlmProviders(str, Enum):DASHSCOPE = "dashscope"MOONSHOT = "moonshot"V0 = "v0"+ LAMBDA_AI = "lambda_ai"DEEPSEEK = "deepseek"SAMBANOVA = "sambanova"MARITALK = "maritalk"diff --git a/litellm/utils.py b/litellm/utils.pyindex e91c626dcb2..fbfe71cf96c 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -6684,6 +6684,8 @@ class ProviderConfigManager:return litellm.DatabricksConfig()elif litellm.LlmProviders.XAI == provider:return litellm.XAIChatConfig()+ elif litellm.LlmProviders.LAMBDA_AI == provider:+ return litellm.LambdaAIChatConfig()elif litellm.LlmProviders.LLAMA == provider:return litellm.LlamaAPIConfig()elif litellm.LlmProviders.TEXT_COMPLETION_OPENAI == provider:diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex 58ec3df9328..4920f560c8c 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -14780,6 +14780,271 @@"supports_system_messages": true,"supports_tool_choice": true},+ "lambda_ai/deepseek-llama3.3-70b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2e-07,+ "output_cost_per_token": 6e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true,+ "supports_reasoning": true+ },+ "lambda_ai/deepseek-r1-0528": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2e-07,+ "output_cost_per_token": 6e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true,+ "supports_reasoning": true+ },+ "lambda_ai/deepseek-r1-671b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 8e-07,+ "output_cost_per_token": 8e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true,+ "supports_reasoning": true+ },+ "lambda_ai/deepseek-v3-0324": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2e-07,+ "output_cost_per_token": 6e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/hermes3-405b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 8e-07,+ "output_cost_per_token": 8e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/hermes3-70b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.2e-07,+ "output_cost_per_token": 3e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/hermes3-8b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2.5e-08,+ "output_cost_per_token": 4e-08,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/lfm-40b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1e-07,+ "output_cost_per_token": 2e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/lfm-7b": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2.5e-08,+ "output_cost_per_token": 4e-08,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama-4-maverick-17b-128e-instruct-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 8192,+ "input_cost_per_token": 5e-08,+ "output_cost_per_token": 1e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama-4-scout-17b-16e-instruct": {+ "max_tokens": 16384,+ "max_input_tokens": 16384,+ "max_output_tokens": 8192,+ "input_cost_per_token": 5e-08,+ "output_cost_per_token": 1e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.1-405b-instruct-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 8e-07,+ "output_cost_per_token": 8e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.1-70b-instruct-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.2e-07,+ "output_cost_per_token": 3e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.1-8b-instruct": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 2.5e-08,+ "output_cost_per_token": 4e-08,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.1-nemotron-70b-instruct-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.2e-07,+ "output_cost_per_token": 3e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.2-11b-vision-instruct": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.5e-08,+ "output_cost_per_token": 2.5e-08,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_vision": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.2-3b-instruct": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.5e-08,+ "output_cost_per_token": 2.5e-08,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/llama3.3-70b-instruct-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 1.2e-07,+ "output_cost_per_token": 3e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/qwen25-coder-32b-instruct": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 5e-08,+ "output_cost_per_token": 1e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },+ "lambda_ai/qwen3-32b-fp8": {+ "max_tokens": 131072,+ "max_input_tokens": 131072,+ "max_output_tokens": 131072,+ "input_cost_per_token": 5e-08,+ "output_cost_per_token": 1e-07,+ "litellm_provider": "lambda_ai",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true,+ "supports_reasoning": true+ },"voyage/voyage-01": {"max_tokens": 4096,"max_input_tokens": 4096,diff --git a/tests/llm_translation/test_lambda_ai.py b/tests/llm_translation/test_lambda_ai.pynew file mode 100644index 00000000000..3b73629b4a7--- /dev/null+++ b/tests/llm_translation/test_lambda_ai.py@@ -0,0 +1,153 @@+"""+Tests for Lambda AI provider integration+"""+import os+from unittest import mock++import pytest++import litellm+from litellm import completion+from litellm.llms.lambda_ai.chat.transformation import LambdaAIChatConfig+++def test_lambda_ai_config_initialization():+ """Test LambdaAIChatConfig initializes correctly"""+ config = LambdaAIChatConfig()+ assert config.custom_llm_provider == "lambda_ai"+++def test_lambda_ai_get_openai_compatible_provider_info():+ """Test Lambda AI provider info retrieval"""+ config = LambdaAIChatConfig()++ # Test with default values (no env vars set)+ with mock.patch.dict(os.environ, {}, clear=True):+ api_base, api_key = config._get_openai_compatible_provider_info(None, None)+ assert api_base == "https://api.lambda.ai/v1"+ assert api_key is None++ # Test with environment variables+ with mock.patch.dict(os.environ, {"LAMBDA_API_KEY": "test-key", "LAMBDA_API_BASE": "https://custom.lambda.ai/v1"}):+ api_base, api_key = config._get_openai_compatible_provider_info(None, None)+ assert api_base == "https://custom.lambda.ai/v1"+ assert api_key == "test-key"++ # Test with explicit parameters (should override env vars)+ with mock.patch.dict(os.environ, {"LAMBDA_API_KEY": "env-key", "LAMBDA_API_BASE": "https://env.lambda.ai/v1"}):+ api_base, api_key = config._get_openai_compatible_provider_info(+ "https://param.lambda.ai/v1", "param-key"+ )+ assert api_base == "https://param.lambda.ai/v1"+ assert api_key == "param-key"+++def test_get_llm_provider_lambda_ai():+ """Test that get_llm_provider correctly identifies Lambda AI"""+ from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider++ # Test with lambda_ai/model-name format+ model, provider, api_key, api_base = get_llm_provider("lambda_ai/llama3.1-8b-instruct")+ assert model == "llama3.1-8b-instruct"+ assert provider == "lambda_ai"++ # Test with api_base containing Lambda AI endpoint+ model, provider, api_key, api_base = get_llm_provider(+ "llama3.1-8b-instruct", api_base="https://api.lambda.ai/v1"+ )+ assert model == "llama3.1-8b-instruct"+ assert provider == "lambda_ai"+ assert api_base == "https://api.lambda.ai/v1"+++def test_lambda_ai_in_provider_lists():+ """Test that Lambda AI is registered in all necessary provider lists"""+ assert "lambda_ai" in litellm.openai_compatible_providers+ assert "lambda_ai" in litellm.provider_list+ assert "https://api.lambda.ai/v1" in litellm.openai_compatible_endpoints+++async def test_lambda_ai_completion_call():+ """Test completion call with Lambda AI provider (requires LAMBDA_API_KEY)"""+ # Skip if no API key is available+ if not os.getenv("LAMBDA_API_KEY"):+ pytest.skip("LAMBDA_API_KEY not set")++ try:+ response = await litellm.acompletion(+ model="lambda_ai/llama3.1-8b-instruct",+ messages=[{"role": "user", "content": "Hello, this is a test"}],+ max_tokens=10,+ )+ assert response.choices[0].message.content+ assert response.model+ assert response.usage+ except Exception as e:+ # If the API key is invalid or there's a network issue, that's okay+ # The important thing is that the provider was recognized+ if "lambda_ai" not in str(e) and "provider" not in str(e).lower():+ # Re-raise if it's not a provider-related error+ raise+++def test_lambda_ai_models_configuration():+ """Test that Lambda AI models are configured correctly"""+ from litellm import get_model_info++ # Reload model cost map to pick up local changes+ os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"+ litellm.model_cost = litellm.get_model_cost_map(url="")++ # Clear and repopulate lambda_ai_models list after reloading model_cost+ litellm.lambda_ai_models = []+ litellm.add_known_models()++ # Some Lambda AI models to test+ lambda_ai_models = [+ "lambda_ai/deepseek-llama3.3-70b",+ "lambda_ai/hermes3-8b",+ "lambda_ai/llama3.1-8b-instruct",+ "lambda_ai/llama3.2-11b-vision-instruct",+ "lambda_ai/qwen25-coder-32b-instruct",+ ]++ for model in lambda_ai_models:+ model_info = get_model_info(model)+ assert model_info is not None, f"Model info not found for {model}"+ assert model_info.get("litellm_provider") == "lambda_ai", f"{model} should have lambda_ai as provider"+ assert model_info.get("mode") == "chat", f"{model} should be in chat mode"+ assert model_info.get("supports_function_calling") is True, f"{model} should support function calling"+ assert model_info.get("supports_system_messages") is True, f"{model} should support system messages"++ # Check vision support for vision models+ if "vision" in model:+ assert model_info.get("supports_vision") is True, f"{model} should support vision"+++def test_lambda_ai_model_list_populated():+ """Test that lambda_ai_models list is populated correctly"""+ # Ensure we're using local model cost map and repopulate models+ os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"+ litellm.model_cost = litellm.get_model_cost_map(url="")++ # Clear and repopulate all model lists after reloading model_cost+ litellm.lambda_ai_models = []+ litellm.add_known_models()++ # This should be populated by the add_known_models function+ assert len(litellm.lambda_ai_models) > 0, "lambda_ai_models list should not be empty"++ # Check that all models in the list are Lambda AI models+ for model in litellm.lambda_ai_models:+ assert model.startswith("lambda_ai/"), f"Model {model} should start with 'lambda_ai/'"++ # Check some expected models are in the list+ expected_models = [+ "lambda_ai/llama3.1-8b-instruct",+ "lambda_ai/hermes3-405b",+ "lambda_ai/deepseek-v3-0324",+ ]++ for model in expected_models:+ assert model in litellm.lambda_ai_models, f"{model} should be in lambda_ai_models list"\ No newline at end of file