diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index f577406fc68..2cef600ea32 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -2887,7 +2887,7 @@ "input_cost_per_token": 5e-06, "output_cost_per_token": 2.5e-05, "litellm_provider": "azure_ai", - "max_input_tokens": 200000, + "max_input_tokens": 1000000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -2916,7 +2916,7 @@ "input_cost_per_token": 5e-06, "output_cost_per_token": 2.5e-05, "litellm_provider": "azure_ai", - "max_input_tokens": 200000, + "max_input_tokens": 1000000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -3010,7 +3010,7 @@ "input_cost_per_token": 5e-06, "output_cost_per_token": 2.5e-05, "litellm_provider": "azure_ai", - "max_input_tokens": 200000, + "max_input_tokens": 1000000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index af69d58f00a..db28118d52b 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -2887,7 +2887,7 @@ "input_cost_per_token": 5e-06, "output_cost_per_token": 2.5e-05, "litellm_provider": "azure_ai", - "max_input_tokens": 200000, + "max_input_tokens": 1000000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -2916,7 +2916,7 @@ "input_cost_per_token": 5e-06, "output_cost_per_token": 2.5e-05, "litellm_provider": "azure_ai", - "max_input_tokens": 200000, + "max_input_tokens": 1000000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -3010,7 +3010,7 @@ "input_cost_per_token": 5e-06, "output_cost_per_token": 2.5e-05, "litellm_provider": "azure_ai", - "max_input_tokens": 200000, + "max_input_tokens": 1000000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", diff --git a/tests/test_litellm/litellm_core_utils/test_get_model_cost_map.py b/tests/test_litellm/litellm_core_utils/test_get_model_cost_map.py index 1a38b5dc769..f21c667276e 100644 --- a/tests/test_litellm/litellm_core_utils/test_get_model_cost_map.py +++ b/tests/test_litellm/litellm_core_utils/test_get_model_cost_map.py @@ -4,6 +4,7 @@ count actual model entries, not reserved meta keys) and the extraction of the ``fallback_generalizations`` block out of the raw map. """ +import json import os import sys @@ -25,6 +26,14 @@ from litellm.litellm_core_utils.get_model_cost_map import ( ) +def _load_root_cost_map() -> dict: + path = os.path.join( + os.path.dirname(__file__), "../../../model_prices_and_context_window.json" + ) + with open(path) as f: + return json.load(f) + + def _make_models(n: int) -> dict: return { f"model-{i}": {"litellm_provider": "openai", "mode": "chat"} for i in range(n) @@ -209,3 +218,33 @@ def test_shipped_backup_marks_claude_4_6_plus_adaptive_not_4_0(): "claude-opus-4-5", ]: assert "supports_adaptive_thinking" not in backup[non_adaptive], non_adaptive + + +@pytest.mark.parametrize( + "cost_map", + [_load_root_cost_map(), GetModelCostMap.load_local_model_cost_map()], + ids=["root", "bundled_backup"], +) +def test_azure_ai_claude_1m_context_entries(cost_map: dict): + """Microsoft Foundry serves a 1M-token context window for Opus 4.6+ and Sonnet + 4.6+, so the ``azure_ai`` entries must not advertise the 200k cap that made + context-aware clients compact prompts early (LIT-4406). Both the root map (used + by default network loading) and the bundled fallback are checked so the two can + never drift apart.""" + for model in [ + "azure_ai/claude-opus-4-6", + "azure_ai/claude-opus-4-7", + "azure_ai/claude-opus-4-8", + "azure_ai/claude-opus-5", + "azure_ai/claude-sonnet-5", + "azure_ai/claude-sonnet-4-6", + ]: + assert cost_map[model]["max_input_tokens"] == 1000000, model + + for model in [ + "azure_ai/claude-opus-4-1", + "azure_ai/claude-opus-4-5", + "azure_ai/claude-sonnet-4-5", + "azure_ai/claude-haiku-4-5", + ]: + assert cost_map[model]["max_input_tokens"] == 200000, model diff --git a/tests/test_litellm/test_claude_opus_4_6_config.py b/tests/test_litellm/test_claude_opus_4_6_config.py index d946d1b41af..89d2cd916e0 100644 --- a/tests/test_litellm/test_claude_opus_4_6_config.py +++ b/tests/test_litellm/test_claude_opus_4_6_config.py @@ -102,7 +102,7 @@ def test_opus_4_6_model_pricing_and_capabilities(): "azure_ai/claude-opus-4-6": { "provider": "azure_ai", "has_long_context_pricing": False, - "max_input_tokens": 200000, + "max_input_tokens": 1000000, }, } diff --git a/tests/test_litellm/test_claude_opus_4_8_config.py b/tests/test_litellm/test_claude_opus_4_8_config.py index 8eead8a9c84..f9f9214295a 100644 --- a/tests/test_litellm/test_claude_opus_4_8_config.py +++ b/tests/test_litellm/test_claude_opus_4_8_config.py @@ -60,10 +60,9 @@ def test_opus_4_8_model_pricing_and_capabilities(): "provider": "vertex_ai-anthropic_models", "max_input_tokens": 1000000, }, - # Microsoft Foundry / Azure caps Opus 4.8 at a 200k context window. "azure_ai/claude-opus-4-8": { "provider": "azure_ai", - "max_input_tokens": 200000, + "max_input_tokens": 1000000, }, }