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(models): add the us-gov. geo inference profile keys for Claude Sonnet 5 and Opus 4.8
mateo-berri7a35c34303e9
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 30621a17df3..28c503966f3 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -42008,6 +42008,70 @@"supports_parallel_tool_use_config": true,"prompt_cache_min_tokens": 1024},+ "us-gov.anthropic.claude-sonnet-5": {+ "bedrock_converse_supports_strict_tools": false,+ "bedrock_output_config_effort_ceiling": "xhigh",+ "cache_creation_input_token_cost": 3e-06,+ "cache_creation_input_token_cost_above_1hr": 4.8e-06,+ "cache_read_input_token_cost": 2.4e-07,+ "input_cost_per_token": 2.4e-06,+ "litellm_provider": "bedrock_converse",+ "max_input_tokens": 1000000,+ "max_output_tokens": 128000,+ "max_tokens": 128000,+ "mode": "chat",+ "output_cost_per_token": 1.2e-05,+ "prompt_cache_min_tokens": 1024,+ "supports_adaptive_thinking": true,+ "supports_assistant_prefill": false,+ "supports_computer_use": true,+ "supports_function_calling": true,+ "supports_max_reasoning_effort": true,+ "supports_mid_conversation_system": true,+ "supports_native_structured_output": false,+ "supports_output_config": true,+ "supports_parallel_tool_use_config": true,+ "supports_pdf_input": true,+ "supports_prompt_caching": true,+ "supports_reasoning": true,+ "supports_response_schema": true,+ "supports_sampling_params": false,+ "supports_tool_choice": true,+ "supports_vision": true,+ "supports_xhigh_reasoning_effort": true+ },+ "us-gov.anthropic.claude-opus-4-8": {+ "bedrock_converse_supports_strict_tools": false,+ "bedrock_output_config_effort_ceiling": "xhigh",+ "cache_creation_input_token_cost": 7.5e-06,+ "cache_creation_input_token_cost_above_1hr": 1.2e-05,+ "cache_read_input_token_cost": 6e-07,+ "input_cost_per_token": 6e-06,+ "litellm_provider": "bedrock_converse",+ "max_input_tokens": 1000000,+ "max_output_tokens": 128000,+ "max_tokens": 128000,+ "mode": "chat",+ "output_cost_per_token": 3e-05,+ "prompt_cache_min_tokens": 1024,+ "supports_adaptive_thinking": true,+ "supports_assistant_prefill": false,+ "supports_computer_use": true,+ "supports_function_calling": true,+ "supports_max_reasoning_effort": true,+ "supports_mid_conversation_system": true,+ "supports_native_structured_output": true,+ "supports_output_config": true,+ "supports_parallel_tool_use_config": true,+ "supports_pdf_input": true,+ "supports_prompt_caching": true,+ "supports_reasoning": true,+ "supports_response_schema": true,+ "supports_sampling_params": false,+ "supports_tool_choice": true,+ "supports_vision": true,+ "supports_xhigh_reasoning_effort": true+ },"au.anthropic.claude-haiku-4-5-20251001-v1:0": {"cache_creation_input_token_cost": 1.375e-06,"cache_creation_input_token_cost_above_1hr": 2.2e-06,diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex 30621a17df3..28c503966f3 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -42008,6 +42008,70 @@"supports_parallel_tool_use_config": true,"prompt_cache_min_tokens": 1024},+ "us-gov.anthropic.claude-sonnet-5": {+ "bedrock_converse_supports_strict_tools": false,+ "bedrock_output_config_effort_ceiling": "xhigh",+ "cache_creation_input_token_cost": 3e-06,+ "cache_creation_input_token_cost_above_1hr": 4.8e-06,+ "cache_read_input_token_cost": 2.4e-07,+ "input_cost_per_token": 2.4e-06,+ "litellm_provider": "bedrock_converse",+ "max_input_tokens": 1000000,+ "max_output_tokens": 128000,+ "max_tokens": 128000,+ "mode": "chat",+ "output_cost_per_token": 1.2e-05,+ "prompt_cache_min_tokens": 1024,+ "supports_adaptive_thinking": true,+ "supports_assistant_prefill": false,+ "supports_computer_use": true,+ "supports_function_calling": true,+ "supports_max_reasoning_effort": true,+ "supports_mid_conversation_system": true,+ "supports_native_structured_output": false,+ "supports_output_config": true,+ "supports_parallel_tool_use_config": true,+ "supports_pdf_input": true,+ "supports_prompt_caching": true,+ "supports_reasoning": true,+ "supports_response_schema": true,+ "supports_sampling_params": false,+ "supports_tool_choice": true,+ "supports_vision": true,+ "supports_xhigh_reasoning_effort": true+ },+ "us-gov.anthropic.claude-opus-4-8": {+ "bedrock_converse_supports_strict_tools": false,+ "bedrock_output_config_effort_ceiling": "xhigh",+ "cache_creation_input_token_cost": 7.5e-06,+ "cache_creation_input_token_cost_above_1hr": 1.2e-05,+ "cache_read_input_token_cost": 6e-07,+ "input_cost_per_token": 6e-06,+ "litellm_provider": "bedrock_converse",+ "max_input_tokens": 1000000,+ "max_output_tokens": 128000,+ "max_tokens": 128000,+ "mode": "chat",+ "output_cost_per_token": 3e-05,+ "prompt_cache_min_tokens": 1024,+ "supports_adaptive_thinking": true,+ "supports_assistant_prefill": false,+ "supports_computer_use": true,+ "supports_function_calling": true,+ "supports_max_reasoning_effort": true,+ "supports_mid_conversation_system": true,+ "supports_native_structured_output": true,+ "supports_output_config": true,+ "supports_parallel_tool_use_config": true,+ "supports_pdf_input": true,+ "supports_prompt_caching": true,+ "supports_reasoning": true,+ "supports_response_schema": true,+ "supports_sampling_params": false,+ "supports_tool_choice": true,+ "supports_vision": true,+ "supports_xhigh_reasoning_effort": true+ },"au.anthropic.claude-haiku-4-5-20251001-v1:0": {"cache_creation_input_token_cost": 1.375e-06,"cache_creation_input_token_cost_above_1hr": 2.2e-06,diff --git a/tests/test_litellm/test_bedrock_usgov_pricing.py b/tests/test_litellm/test_bedrock_usgov_pricing.pyindex f9e8fd4c46c..f7d95ecda01 100644--- a/tests/test_litellm/test_bedrock_usgov_pricing.py+++ b/tests/test_litellm/test_bedrock_usgov_pricing.py@@ -135,15 +135,24 @@ CLAUDE_GOV_EXPECTED = {}+USGOV_CLAUDE_KEY_TEMPLATES = {+ "bedrock/us-gov-east-1/{base_key}": "bedrock",+ "bedrock/us-gov-west-1/{base_key}": "bedrock",+ "us-gov.{base_key}": "bedrock_converse",+}++@pytest.mark.parametrize("base_key", CLAUDE_GOV_EXPECTED)[email protected]("region", ["us-gov-east-1", "us-gov-west-1"])-def test_usgov_claude_sonnet5_opus48_pricing(model_data, region, base_key):- """Sonnet 5 and Opus 4.8 gov entries must match the rates AWS publishes- for both GovCloud regions on the Bedrock pricing page (1.2x global).[email protected]("key_template,expected_provider", USGOV_CLAUDE_KEY_TEMPLATES.items())+def test_usgov_claude_sonnet5_opus48_pricing(model_data, key_template, expected_provider, base_key):+ """Sonnet 5 and Opus 4.8 gov entries, both in-region keys and the us-gov.+ geo inference profile the model cards list for GovCloud, must match the+ rates AWS publishes on the Bedrock pricing page (1.2x global)."""- gov_key = f"bedrock/{region}/{base_key}"+ gov_key = key_template.format(base_key=base_key)assert gov_key in model_data, f"Missing model entry: {gov_key}"info = model_data[gov_key]+ assert info["litellm_provider"] == expected_providerfor field, expected in CLAUDE_GOV_EXPECTED[base_key].items():assert info[field] == expected, f"{gov_key}: {field} should be {expected} (got {info[field]})"ratio = info[field] / model_data[base_key][field]