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(model_prices): raise bedrock_mantle gpt-5.5 and gpt-5.4 max_input_tokens to Mantle's enforced 1050000
mateo-berrib97d5e77eb56
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 9ca8d9e1bac..eca41b22bd5 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -49605,7 +49605,7 @@"cache_read_input_token_cost": 5.5e-07,"output_cost_per_token": 3.3e-05,"litellm_provider": "bedrock_mantle",- "max_input_tokens": 272000,+ "max_input_tokens": 1050000,"max_output_tokens": 128000,"max_tokens": 128000,"mode": "responses",@@ -49632,7 +49632,7 @@"cache_read_input_token_cost": 2.75e-07,"output_cost_per_token": 1.65e-05,"litellm_provider": "bedrock_mantle",- "max_input_tokens": 272000,+ "max_input_tokens": 1050000,"max_output_tokens": 128000,"max_tokens": 128000,"mode": "responses",diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex 9ca8d9e1bac..eca41b22bd5 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -49605,7 +49605,7 @@"cache_read_input_token_cost": 5.5e-07,"output_cost_per_token": 3.3e-05,"litellm_provider": "bedrock_mantle",- "max_input_tokens": 272000,+ "max_input_tokens": 1050000,"max_output_tokens": 128000,"max_tokens": 128000,"mode": "responses",@@ -49632,7 +49632,7 @@"cache_read_input_token_cost": 2.75e-07,"output_cost_per_token": 1.65e-05,"litellm_provider": "bedrock_mantle",- "max_input_tokens": 272000,+ "max_input_tokens": 1050000,"max_output_tokens": 128000,"max_tokens": 128000,"mode": "responses",diff --git a/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py b/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.pyindex c875bf5b535..e13643ed6ce 100644--- a/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py+++ b/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py@@ -531,6 +531,43 @@ def test_generic_cost_per_token_bedrock_mantle_gpt56_long_context(_local_model_c)+ "model",+ [+ "bedrock_mantle/openai.gpt-5.5",+ "bedrock_mantle/openai.gpt-5.4",+ ],+)+def test_generic_cost_per_token_bedrock_mantle_gpt55_gpt54_long_context_flat_rate(_local_model_cost_map, model):+ """Bedrock serves gpt-5.5 and gpt-5.4 up to its enforced 1,050,000-token prompt maximum and documents+ no long-context tier for them, so a prompt past 272K is billed at the flat per-token rates."""++ model_cost_map = litellm.model_cost[model]+ assert model_cost_map["max_input_tokens"] == 1050000+ assert [key for key in model_cost_map if "above_272k" in key] == []++ served_prompt_tokens = 1030590+ cached_tokens = 100000+ completion_tokens = 1000+ usage = Usage(+ prompt_tokens=served_prompt_tokens,+ completion_tokens=completion_tokens,+ total_tokens=served_prompt_tokens + completion_tokens,+ prompt_tokens_details=PromptTokensDetailsWrapper(cached_tokens=cached_tokens),+ )+ prompt_cost, completion_cost = generic_cost_per_token(+ model=model,+ usage=usage,+ custom_llm_provider="bedrock_mantle",+ )+ assert round(prompt_cost, 10) == round(+ model_cost_map["input_cost_per_token"] * (served_prompt_tokens - cached_tokens)+ + model_cost_map["cache_read_input_token_cost"] * cached_tokens,+ 10,+ )+ assert round(completion_cost, 10) == round(model_cost_map["output_cost_per_token"] * completion_tokens, 10)++def test_generic_cost_per_token_honors_non_standard_above_threshold():"""Regression for #30344: get_model_info must keep arbitraryinput/output_cost_per_token_above_<N>_tokens thresholds, not only the hard-codeddiff --git a/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py b/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.pyindex 00a319f99f0..6a6fb8e3730 100644--- a/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py+++ b/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py@@ -1673,7 +1673,7 @@ class TestBedrockMantleResponsesPricing:assert info["input_cost_per_token"] == pytest.approx(5.5e-06)assert info["output_cost_per_token"] == pytest.approx(3.3e-05)assert info["cache_read_input_token_cost"] == pytest.approx(5.5e-07)- assert info["max_input_tokens"] == 272000+ assert info["max_input_tokens"] == 1050000def test_gpt_5_4_pricing_and_mode(self, local_cost_map):info = litellm.get_model_info("bedrock_mantle/openai.gpt-5.4")@@ -1681,7 +1681,7 @@ class TestBedrockMantleResponsesPricing:assert info["input_cost_per_token"] == pytest.approx(2.75e-06)assert info["output_cost_per_token"] == pytest.approx(1.65e-05)assert info["cache_read_input_token_cost"] == pytest.approx(2.75e-07)- assert info["max_input_tokens"] == 272000+ assert info["max_input_tokens"] == 1050000@pytest.mark.parametrize("model, input_cost, cache_creation_cost, cache_read_cost, output_cost",@@ -1753,13 +1753,14 @@ def _repo_cost_map(map_name: str) -> dict[str, dict[str, object]]:return json.loads(paths[map_name].read_text())-class TestGpt56MantleRegistryEntries:- """Locks the gpt-5.6 frontier entries to Bedrock Mantle's live behavior.+class TestMantleGptRegistryEntries:+ """Locks the OpenAI GPT entries to Bedrock Mantle's live behavior.Mantle enforces a 1,050,000-token prompt maximum for gpt-5.6 sol/terra/luna- (oversize requests 400 with "prompt tokens (N) exceed model maximum- (1050000)", and a 1,030,590-token request completes), matching the OpenAI- Bedrock guide. mode must stay "responses": Mantle's native+ and for gpt-5.5 and gpt-5.4 (oversize requests 400 with "prompt tokens (N)+ exceed model maximum (1050000)", and a 1,030,590-token request completes+ on every one of them), while the AWS model cards still quote 272K for+ gpt-5.5 and gpt-5.4. mode must stay "responses": Mantle's native/v1/chat/completions rejects function tools unless reasoning_effort is"none", so chat traffic has to keep bridging to the Responses API(see the responses_api_bridge tests above).@@ -1781,3 +1782,18 @@ class TestGpt56MantleRegistryEntries:assert entry["mode"] == "responses"assert entry["use_openai_responses_path"] is Trueassert entry["supported_endpoints"] == ["/v1/chat/completions", "/v1/responses"]++ @pytest.mark.parametrize("map_name", ("root", "bundled_backup"))+ @pytest.mark.parametrize(+ "key",+ (+ "bedrock_mantle/openai.gpt-5.5",+ "bedrock_mantle/openai.gpt-5.4",+ ),+ )+ def test_gpt_55_and_54_entries_match_mantle_enforced_limits(self, map_name, key):+ entry = _repo_cost_map(map_name)[key]+ assert entry["max_input_tokens"] == 1050000+ assert entry["max_output_tokens"] == 128000+ assert entry["mode"] == "responses"+ assert entry["use_openai_responses_path"] is True