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
test(cost_map): skip every reserved top-level key in the price map schema test
mateo-berriaa1c76bc3b60
diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.pyindex 8a56a84ade7..f6c9a4537a1 100644--- a/tests/test_litellm/test_utils.py+++ b/tests/test_litellm/test_utils.py@@ -21,6 +21,7 @@ from litellm._logging import (verbose_logger,)from litellm.integrations.custom_logger import CustomLogger+from litellm.litellm_core_utils.get_model_cost_map import RESERVED_TOP_LEVEL_KEYSfrom litellm.proxy.utils import is_valid_api_keyfrom litellm.types.utils import (CallTypes,@@ -1218,15 +1219,12 @@ def test_aaamodel_prices_and_context_window_json_is_valid():with open(prod_json, "r") as model_prices_file:actual_json = json.load(model_prices_file)assert isinstance(actual_json, dict)- actual_json.pop(- "sample_spec", None- ) # remove the sample, whose schema is inconsistent with the real data- actual_json.pop(- "fallback_generalizations", None- ) # reserved meta key, not a model entry+ model_entries: Final = {+ key: value for key, value in actual_json.items() if key not in RESERVED_TOP_LEVEL_KEYS+ }# Validate schema- validate(actual_json, INTENDED_SCHEMA)+ validate(model_entries, INTENDED_SCHEMA)# Validate cost values# Define exceptions for models that are allowed to have costs > 1@@ -1237,7 +1235,7 @@ def test_aaamodel_prices_and_context_window_json_is_valid():"runwayml/seedance2", # 4K output is 150 credits/second = $1.50/second]- is_valid, violations = validate_model_cost_values(actual_json, exceptions)+ is_valid, violations = validate_model_cost_values(model_entries, exceptions)if not is_valid:error_message = "Cost validation failed:\n" + "\n".join(violations)@@ -1268,8 +1266,7 @@ def test_max_tokens_consistency():inconsistencies = []for model_name, config in models.items():- # Skip the sample_spec- if model_name == "sample_spec":+ if model_name in RESERVED_TOP_LEVEL_KEYS:continue# Check if both max_tokens and max_output_tokens exist