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
amazon nova api fix
Ishaan Jafferb4970f603302
diff --git a/docs/my-website/docs/providers/amazon_nova.md b/docs/my-website/docs/providers/amazon_nova.mdindex 30479ebd771..69c61d9d978 100644--- a/docs/my-website/docs/providers/amazon_nova.md+++ b/docs/my-website/docs/providers/amazon_nova.md@@ -6,7 +6,7 @@ import TabItem from '@theme/TabItem';| Property | Details ||-------|-------|| Description | Amazon Nova is a family of foundation models built by Amazon that deliver frontier intelligence and industry-leading price performance. |-| Provider Route on LiteLLM | `amazon-nova/` |+| Provider Route on LiteLLM | `amazon_nova/` || Provider Doc | [Amazon Nova ↗](https://docs.aws.amazon.com/nova/latest/userguide/what-is-nova.html) || Supported OpenAI Endpoints | `/chat/completions`, `v1/responses` || Other Supported Endpoints | `v1/messages`, `/generateContent` |@@ -32,7 +32,7 @@ from litellm import completionos.environ["AMAZON_NOVA_API_KEY"] = "your-api-key"response = completion(- model="amazon-nova/nova-micro-v1",+ model="amazon_nova/nova-micro-v1",messages=[{"role": "system", "content": "You are a helpful assistant"},{"role": "user", "content": "Hello, how are you?"}@@ -51,7 +51,7 @@ print(response)model_list:- model_name: amazon-nova-microlitellm_params:- model: amazon-nova/nova-micro-v1+ model: amazon_nova/nova-micro-v1api_key: os.environ/AMAZON_NOVA_API_KEY```### 2. Start the proxy@@ -82,7 +82,7 @@ curl --location 'http://0.0.0.0:4000/chat/completions' \| Model Name | Usage | Context Window ||------------|-------|----------------|-| Nova Micro | `completion(model="amazon-nova/nova-micro-v1", messages=messages)` | 128K tokens |+| Nova Micro | `completion(model="amazon_nova/nova-micro-v1", messages=messages)` | 128K tokens || Nova Lite | `completion(model="amazon-nova/nova-lite-v1", messages=messages)` | 300K tokens || Nova Pro | `completion(model="amazon-nova/nova-pro-v1", messages=messages)` | 300K tokens || Nova Premier | `completion(model="amazon-nova/nova-premier-v1", messages=messages)` | 1M tokens |@@ -99,7 +99,7 @@ from litellm import completionos.environ["AMAZON_NOVA_API_KEY"] = "your-api-key"response = completion(- model="amazon-nova/nova-micro-v1",+ model="amazon_nova/nova-micro-v1",messages=[{"role": "system", "content": "You are a helpful assistant"},{"role": "user", "content": "Tell me about machine learning"}@@ -164,7 +164,7 @@ tools = []response = completion(- model="amazon-nova/nova-micro-v1",+ model="amazon_nova/nova-micro-v1",messages=[{"role": "user", "content": "What's the weather like in San Francisco?"}],@@ -246,7 +246,7 @@ print(response)model_list:- model_name: amazon-nova-prolitellm_params:- model: amazon-nova/nova-pro-v1+ model: amazon_nova/nova-pro-v1temperature: 0.8max_tokens: 500top_p: 0.9diff --git a/litellm/__init__.py b/litellm/__init__.pyindex e4ad39d2534..a4ade3bccae 100644--- a/litellm/__init__.py+++ b/litellm/__init__.py@@ -816,7 +816,7 @@ def add_known_models():lemonade_models.add(key)elif value.get("litellm_provider") == "docker_model_runner":docker_model_runner_models.add(key)- elif value.get("litellm_provider") == "amazon-nova":+ elif value.get("litellm_provider") == "amazon_nova":amazon_nova_models.add(key)@@ -1019,7 +1019,7 @@ models_by_provider: dict = {"ovhcloud": ovhcloud_models | ovhcloud_embedding_models,"lemonade": lemonade_models,"clarifai": clarifai_models,- "amazon-nova": amazon_nova_models,+ "amazon_nova": amazon_nova_models,}# mapping for those models which have larger equivalentsdiff --git a/litellm/constants.py b/litellm/constants.pyindex a7cab1ca232..1c0f800eccd 100644--- a/litellm/constants.py+++ b/litellm/constants.py@@ -414,7 +414,7 @@ LITELLM_CHAT_PROVIDERS = ["ovhcloud","lemonade","docker_model_runner",- "amazon-nova",+ "amazon_nova",]LITELLM_EMBEDDING_PROVIDERS_SUPPORTING_INPUT_ARRAY_OF_TOKENS = [diff --git a/litellm/litellm_core_utils/get_llm_provider_logic.py b/litellm/litellm_core_utils/get_llm_provider_logic.pyindex 52ba7a9cdbc..168c837f1e5 100644--- a/litellm/litellm_core_utils/get_llm_provider_logic.py+++ b/litellm/litellm_core_utils/get_llm_provider_logic.py@@ -404,8 +404,8 @@ def get_llm_provider( # noqa: PLR0915custom_llm_provider = "lemonade"elif model.startswith("clarifai/"):custom_llm_provider = "clarifai"- elif model.startswith("amazon-nova"):- custom_llm_provider = "amazon-nova"+ elif model.startswith("amazon_nova"):+ custom_llm_provider = "amazon_nova"if not custom_llm_provider:if litellm.suppress_debug_info is False:print() # noqadiff --git a/litellm/llms/amazon_nova/chat/transformation.py b/litellm/llms/amazon_nova/chat/transformation.pyindex 325b0cb14b0..6d321e298b8 100644--- a/litellm/llms/amazon_nova/chat/transformation.py+++ b/litellm/llms/amazon_nova/chat/transformation.py@@ -41,7 +41,7 @@ class AmazonNovaChatConfig(OpenAILikeChatConfig):@propertydef custom_llm_provider(self) -> Optional[str]:- return "amazon-nova"+ return "amazon_nova"@classmethoddef get_config(cls):diff --git a/litellm/llms/amazon_nova/cost_calculation.py b/litellm/llms/amazon_nova/cost_calculation.pyindex 0b35d6ea00b..9d9cedde875 100644--- a/litellm/llms/amazon_nova/cost_calculation.py+++ b/litellm/llms/amazon_nova/cost_calculation.py@@ -17,5 +17,5 @@ def cost_per_token(model: str, usage: "Usage") -> Tuple[float, float]:Follows the same logic as Anthropic's cost per token calculation."""return generic_cost_per_token(- model=model, usage=usage, custom_llm_provider="amazon-nova"+ model=model, usage=usage, custom_llm_provider="amazon_nova")\ No newline at end of filediff --git a/litellm/main.py b/litellm/main.pyindex b5d55f9f998..59838c2a035 100644--- a/litellm/main.py+++ b/litellm/main.py@@ -52,10 +52,13 @@ from pydantic import BaseModelfrom typing_extensions import overloadimport litellm+# client must be imported from litellm as it's a decorator used at function definition timefrom litellm import client+# Other utils are imported directly to avoid circular importsfrom litellm.utils import exception_type, get_litellm_params, get_optional_params+# Logging is imported lazily when needed to avoid loading litellm_logging at import timeif TYPE_CHECKING:from litellm.litellm_core_utils.litellm_logging import Logging@@ -2662,7 +2665,7 @@ def completion( # type: ignore # noqa: PLR0915)response = model_response- elif custom_llm_provider == "amazon-nova":+ elif custom_llm_provider == "amazon_nova":api_key = (api_keyor litellm.amazon_nova_api_keydiff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex e0df56dd7d7..79a6d2de06a 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -16957,7 +16957,7 @@},"amazon-nova/nova-micro-v1": {"input_cost_per_token": 3.5e-08,- "litellm_provider": "amazon-nova",+ "litellm_provider": "amazon_nova","max_input_tokens": 128000,"max_output_tokens": 10000,"max_tokens": 10000,@@ -16969,7 +16969,7 @@},"amazon-nova/nova-lite-v1": {"input_cost_per_token": 6e-08,- "litellm_provider": "amazon-nova",+ "litellm_provider": "amazon_nova","max_input_tokens": 300000,"max_output_tokens": 10000,"max_tokens": 10000,@@ -16983,7 +16983,7 @@},"amazon-nova/nova-premier-v1": {"input_cost_per_token": 2.5e-06,- "litellm_provider": "amazon-nova",+ "litellm_provider": "amazon_nova","max_input_tokens": 1000000,"max_output_tokens": 10000,"max_tokens": 10000,@@ -16997,7 +16997,7 @@},"amazon-nova/nova-pro-v1": {"input_cost_per_token": 8e-07,- "litellm_provider": "amazon-nova",+ "litellm_provider": "amazon_nova","max_input_tokens": 300000,"max_output_tokens": 10000,"max_tokens": 10000,diff --git a/litellm/types/utils.py b/litellm/types/utils.pyindex 10081765d4d..5821ae3d233 100644--- a/litellm/types/utils.py+++ b/litellm/types/utils.py@@ -3002,7 +3002,7 @@ class LlmProviders(str, Enum):WANDB = "wandb"OVHCLOUD = "ovhcloud"LEMONADE = "lemonade"- AMAZON_NOVA = "amazon-nova"+ AMAZON_NOVA = "amazon_nova"A2A_AGENT = "a2a_agent"diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex e0df56dd7d7..79a6d2de06a 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -16957,7 +16957,7 @@},"amazon-nova/nova-micro-v1": {"input_cost_per_token": 3.5e-08,- "litellm_provider": "amazon-nova",+ "litellm_provider": "amazon_nova","max_input_tokens": 128000,"max_output_tokens": 10000,"max_tokens": 10000,@@ -16969,7 +16969,7 @@},"amazon-nova/nova-lite-v1": {"input_cost_per_token": 6e-08,- "litellm_provider": "amazon-nova",+ "litellm_provider": "amazon_nova","max_input_tokens": 300000,"max_output_tokens": 10000,"max_tokens": 10000,@@ -16983,7 +16983,7 @@},"amazon-nova/nova-premier-v1": {"input_cost_per_token": 2.5e-06,- "litellm_provider": "amazon-nova",+ "litellm_provider": "amazon_nova","max_input_tokens": 1000000,"max_output_tokens": 10000,"max_tokens": 10000,@@ -16997,7 +16997,7 @@},"amazon-nova/nova-pro-v1": {"input_cost_per_token": 8e-07,- "litellm_provider": "amazon-nova",+ "litellm_provider": "amazon_nova","max_input_tokens": 300000,"max_output_tokens": 10000,"max_tokens": 10000,