diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index a6f59abc140..cdd5f963c24 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -29857,6 +29857,126 @@ "supports_vision": true, "supports_xhigh_reasoning_effort": true }, + "openrouter/anthropic/claude-sonnet-5": { + "supports_adaptive_thinking": true, + "cache_creation_input_token_cost": 2.5e-06, + "cache_read_input_token_cost": 2e-07, + "input_cost_per_token": 2e-06, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 1e-05, + "source": "https://openrouter.ai/anthropic/claude-sonnet-5", + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_max_reasoning_effort": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_xhigh_reasoning_effort": true + }, + "openrouter/anthropic/claude-opus-4.8": { + "supports_adaptive_thinking": true, + "cache_creation_input_token_cost": 6.25e-06, + "cache_read_input_token_cost": 5e-07, + "input_cost_per_token": 5e-06, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.5e-05, + "source": "https://openrouter.ai/anthropic/claude-opus-4.8", + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_max_reasoning_effort": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_xhigh_reasoning_effort": true + }, + "openrouter/anthropic/claude-opus-4.8-fast": { + "supports_adaptive_thinking": true, + "cache_creation_input_token_cost": 1.25e-05, + "cache_read_input_token_cost": 1e-06, + "input_cost_per_token": 1e-05, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 5e-05, + "source": "https://openrouter.ai/anthropic/claude-opus-4.8-fast", + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_max_reasoning_effort": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_xhigh_reasoning_effort": true + }, + "openrouter/anthropic/claude-opus-4.7-fast": { + "supports_adaptive_thinking": true, + "cache_creation_input_token_cost": 3.75e-05, + "cache_read_input_token_cost": 3e-06, + "input_cost_per_token": 3e-05, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 1.5e-04, + "source": "https://openrouter.ai/anthropic/claude-opus-4.7-fast", + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_max_reasoning_effort": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_xhigh_reasoning_effort": true + }, + "openrouter/anthropic/claude-fable-5": { + "supports_adaptive_thinking": true, + "cache_creation_input_token_cost": 1.25e-05, + "cache_read_input_token_cost": 1e-06, + "input_cost_per_token": 1e-05, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 5e-05, + "source": "https://openrouter.ai/anthropic/claude-fable-5", + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_max_reasoning_effort": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_xhigh_reasoning_effort": true + }, "openrouter/bytedance/ui-tars-1.5-7b": { "input_cost_per_token": 1e-07, "litellm_provider": "openrouter", diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 08a452be844..68a0943ed18 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -29932,6 +29932,126 @@ "supports_vision": true, "supports_xhigh_reasoning_effort": true }, + "openrouter/anthropic/claude-sonnet-5": { + "supports_adaptive_thinking": true, + "cache_creation_input_token_cost": 2.5e-06, + "cache_read_input_token_cost": 2e-07, + "input_cost_per_token": 2e-06, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 1e-05, + "source": "https://openrouter.ai/anthropic/claude-sonnet-5", + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_max_reasoning_effort": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_xhigh_reasoning_effort": true + }, + "openrouter/anthropic/claude-opus-4.8": { + "supports_adaptive_thinking": true, + "cache_creation_input_token_cost": 6.25e-06, + "cache_read_input_token_cost": 5e-07, + "input_cost_per_token": 5e-06, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.5e-05, + "source": "https://openrouter.ai/anthropic/claude-opus-4.8", + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_max_reasoning_effort": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_xhigh_reasoning_effort": true + }, + "openrouter/anthropic/claude-opus-4.8-fast": { + "supports_adaptive_thinking": true, + "cache_creation_input_token_cost": 1.25e-05, + "cache_read_input_token_cost": 1e-06, + "input_cost_per_token": 1e-05, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 5e-05, + "source": "https://openrouter.ai/anthropic/claude-opus-4.8-fast", + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_max_reasoning_effort": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_xhigh_reasoning_effort": true + }, + "openrouter/anthropic/claude-opus-4.7-fast": { + "supports_adaptive_thinking": true, + "cache_creation_input_token_cost": 3.75e-05, + "cache_read_input_token_cost": 3e-06, + "input_cost_per_token": 3e-05, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 1.5e-04, + "source": "https://openrouter.ai/anthropic/claude-opus-4.7-fast", + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_max_reasoning_effort": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_xhigh_reasoning_effort": true + }, + "openrouter/anthropic/claude-fable-5": { + "supports_adaptive_thinking": true, + "cache_creation_input_token_cost": 1.25e-05, + "cache_read_input_token_cost": 1e-06, + "input_cost_per_token": 1e-05, + "litellm_provider": "openrouter", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 5e-05, + "source": "https://openrouter.ai/anthropic/claude-fable-5", + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_max_reasoning_effort": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_xhigh_reasoning_effort": true + }, "openrouter/bytedance/ui-tars-1.5-7b": { "input_cost_per_token": 1e-07, "litellm_provider": "openrouter", 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..1be0b8a0096 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 @@ -209,3 +209,29 @@ 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 + + +def test_shipped_backup_has_current_openrouter_claude_routes(): + """Regression for #33068: the current OpenRouter Claude routes (sonnet 5, + opus 4.8, opus 4.8-fast, opus 4.7-fast, fable 5) must ship in the bundled + backup with the pricing and token limits OpenRouter actually serves. + Without these entries litellm resolves no cost or context window for them, + so cost tracking silently reports nothing and get_model_info raises.""" + backup = GetModelCostMap.load_local_model_cost_map() + + expected = { + "openrouter/anthropic/claude-sonnet-5": (2e-06, 1e-05), + "openrouter/anthropic/claude-opus-4.8": (5e-06, 2.5e-05), + "openrouter/anthropic/claude-opus-4.8-fast": (1e-05, 5e-05), + "openrouter/anthropic/claude-opus-4.7-fast": (3e-05, 1.5e-04), + "openrouter/anthropic/claude-fable-5": (1e-05, 5e-05), + } + + for model, (input_cost, output_cost) in expected.items(): + entry = backup[model] + assert entry["litellm_provider"] == "openrouter", model + assert entry["input_cost_per_token"] == input_cost, model + assert entry["output_cost_per_token"] == output_cost, model + assert entry["max_input_tokens"] == 1000000, model + assert entry["max_output_tokens"] == 128000, model + assert entry["max_tokens"] == 128000, model