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
fix(pricing): add undated azure aliases for gpt-audio-mini and gpt-realtime-mini (#37867)
tin-berri4e191273508e
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 4c1f777ce3e..3af7d9e5019 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -4881,6 +4881,38 @@"supports_tool_choice": true,"supports_vision": false},+ "azure/gpt-audio-mini": {+ "deprecation_date": "2027-04-06",+ "input_cost_per_audio_token": 1e-05,+ "input_cost_per_token": 6e-07,+ "litellm_provider": "azure",+ "max_input_tokens": 128000,+ "max_output_tokens": 16384,+ "max_tokens": 16384,+ "mode": "chat",+ "output_cost_per_audio_token": 2e-05,+ "output_cost_per_token": 2.4e-06,+ "supported_endpoints": [+ "/v1/chat/completions"+ ],+ "supported_modalities": [+ "text",+ "audio"+ ],+ "supported_output_modalities": [+ "text",+ "audio"+ ],+ "supports_function_calling": true,+ "supports_native_streaming": true,+ "supports_parallel_function_calling": true,+ "supports_prompt_caching": false,+ "supports_reasoning": false,+ "supports_response_schema": false,+ "supports_system_messages": true,+ "supports_tool_choice": true,+ "supports_vision": false+ },"azure/gpt-audio-mini-2025-10-06": {"deprecation_date": "2027-04-06","input_cost_per_audio_token": 1e-05,@@ -5094,6 +5126,38 @@"supports_system_messages": true,"supports_tool_choice": true},+ "azure/gpt-realtime-mini": {+ "cache_creation_input_audio_token_cost": 3e-07,+ "cache_read_input_token_cost": 6e-08,+ "input_cost_per_audio_token": 1e-05,+ "input_cost_per_image": 8e-07,+ "input_cost_per_token": 6e-07,+ "litellm_provider": "azure",+ "max_input_tokens": 32000,+ "max_output_tokens": 4096,+ "max_tokens": 4096,+ "mode": "realtime",+ "output_cost_per_audio_token": 2e-05,+ "output_cost_per_token": 2.4e-06,+ "supported_endpoints": [+ "/v1/realtime"+ ],+ "supported_modalities": [+ "text",+ "image",+ "audio"+ ],+ "supported_output_modalities": [+ "text",+ "audio"+ ],+ "supports_audio_input": true,+ "supports_audio_output": true,+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },"azure/gpt-realtime-mini-2025-10-06": {"cache_creation_input_audio_token_cost": 3e-07,"cache_read_input_token_cost": 6e-08,diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex 4c1f777ce3e..3af7d9e5019 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -4881,6 +4881,38 @@"supports_tool_choice": true,"supports_vision": false},+ "azure/gpt-audio-mini": {+ "deprecation_date": "2027-04-06",+ "input_cost_per_audio_token": 1e-05,+ "input_cost_per_token": 6e-07,+ "litellm_provider": "azure",+ "max_input_tokens": 128000,+ "max_output_tokens": 16384,+ "max_tokens": 16384,+ "mode": "chat",+ "output_cost_per_audio_token": 2e-05,+ "output_cost_per_token": 2.4e-06,+ "supported_endpoints": [+ "/v1/chat/completions"+ ],+ "supported_modalities": [+ "text",+ "audio"+ ],+ "supported_output_modalities": [+ "text",+ "audio"+ ],+ "supports_function_calling": true,+ "supports_native_streaming": true,+ "supports_parallel_function_calling": true,+ "supports_prompt_caching": false,+ "supports_reasoning": false,+ "supports_response_schema": false,+ "supports_system_messages": true,+ "supports_tool_choice": true,+ "supports_vision": false+ },"azure/gpt-audio-mini-2025-10-06": {"deprecation_date": "2027-04-06","input_cost_per_audio_token": 1e-05,@@ -5094,6 +5126,38 @@"supports_system_messages": true,"supports_tool_choice": true},+ "azure/gpt-realtime-mini": {+ "cache_creation_input_audio_token_cost": 3e-07,+ "cache_read_input_token_cost": 6e-08,+ "input_cost_per_audio_token": 1e-05,+ "input_cost_per_image": 8e-07,+ "input_cost_per_token": 6e-07,+ "litellm_provider": "azure",+ "max_input_tokens": 32000,+ "max_output_tokens": 4096,+ "max_tokens": 4096,+ "mode": "realtime",+ "output_cost_per_audio_token": 2e-05,+ "output_cost_per_token": 2.4e-06,+ "supported_endpoints": [+ "/v1/realtime"+ ],+ "supported_modalities": [+ "text",+ "image",+ "audio"+ ],+ "supported_output_modalities": [+ "text",+ "audio"+ ],+ "supports_audio_input": true,+ "supports_audio_output": true,+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_system_messages": true,+ "supports_tool_choice": true+ },"azure/gpt-realtime-mini-2025-10-06": {"cache_creation_input_audio_token_cost": 3e-07,"cache_read_input_token_cost": 6e-08,diff --git a/tests/test_litellm/test_azure_audio_price_aliases.py b/tests/test_litellm/test_azure_audio_price_aliases.pynew file mode 100644index 00000000000..b87744aeae1--- /dev/null+++ b/tests/test_litellm/test_azure_audio_price_aliases.py@@ -0,0 +1,75 @@+"""Undated azure aliases for the audio models must exist and match their dated+variants. Azure deployments are commonly created under an admin-chosen name, so+the served model name means nothing to the cost lookup and `base_model:+azure/gpt-audio-mini` is what prices the call. That key resolved to nothing, the+lookup raised "This model isn't mapped yet", and the proxy logged the request at+$0. Issue #33170."""++import json+from pathlib import Path++import pytest++import litellm++pytestmark = pytest.mark.usefixtures("local_model_cost_map")+++COST_FIELDS = (+ "input_cost_per_token",+ "output_cost_per_token",+ "input_cost_per_audio_token",+ "output_cost_per_audio_token",+)++ALIAS_PAIRS = (+ ("azure/gpt-audio-mini", "azure/gpt-audio-mini-2025-10-06"),+ ("azure/gpt-realtime-mini", "azure/gpt-realtime-mini-2025-10-06"),+)+++def _load_root_cost_map() -> dict:+ root_map_path = Path(__file__).parents[2] / "model_prices_and_context_window.json"+ with open(root_map_path) as f:+ return json.load(f)++[email protected]("undated, dated", ALIAS_PAIRS)+def test_undated_azure_audio_alias_matches_dated_entry(undated, dated):+ undated_info = litellm.get_model_info(undated)+ dated_info = litellm.get_model_info(dated)++ for field in COST_FIELDS:+ assert undated_info.get(field) == dated_info.get(field), field+ assert (undated_info.get(field) or 0) > 0, f"{undated}.{field} must be non-zero"++ assert undated_info.get("litellm_provider") == "azure"+ assert undated_info.get("mode") == dated_info.get("mode")++[email protected]("undated, dated", ALIAS_PAIRS)+def test_undated_azure_audio_alias_is_exact_mirror(undated, dated):+ """The undated alias must be a byte-for-byte mirror of its dated entry, covering+ every field (incl. realtime-specific cache/audio cost keys) so any future drift+ between the pair is caught, not just the core COST_FIELDS."""+ model_map = litellm.model_cost+ assert undated in model_map, f"{undated} missing from model cost map"+ assert model_map[undated] == model_map[dated], (+ f"{undated} must exactly mirror {dated}; "+ f"diff keys: {[k for k in set(model_map[undated]) | set(model_map[dated]) if model_map[undated].get(k) != model_map[dated].get(k)]}"+ )++[email protected]("undated, dated", ALIAS_PAIRS)+def test_undated_azure_audio_alias_is_in_the_root_cost_map(undated, dated):+ """`local_model_cost_map` pins `litellm.model_cost` to the packaged backup, but a+ proxy left on its defaults fetches the root map instead, and that is the copy+ that ships to the CDN. An alias added to only one of the two files still bills+ $0 for every proxy reading the other, which is the very bug this file guards, so+ assert the root map directly and assert the two files agree."""+ root_map = _load_root_cost_map()+ assert undated in root_map, f"{undated} missing from the root cost map"+ assert root_map[undated] == root_map[dated], f"{undated} must exactly mirror {dated} in the root cost map"+ assert root_map[undated] == litellm.model_cost[undated], (+ f"{undated} differs between the root cost map and the packaged backup"+ )diff --git a/tests/test_litellm/test_gpt_realtime_mode.py b/tests/test_litellm/test_gpt_realtime_mode.pyindex 4413cbc12ef..ed593228621 100644--- a/tests/test_litellm/test_gpt_realtime_mode.py+++ b/tests/test_litellm/test_gpt_realtime_mode.py@@ -10,6 +10,7 @@ from litellm.types.utils import ModelInfoBaseREALTIME_ONLY_GPT_MODELS = ("azure/gpt-realtime-2025-08-28","azure/gpt-realtime-1.5-2026-02-23",+ "azure/gpt-realtime-mini","azure/gpt-realtime-mini-2025-10-06","gpt-realtime","gpt-realtime-1.5",