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
refactor(model_prices): keep fallback_generalizations last in the registry
mateo69def0545d24
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 90491cefd3c..873b1eb24d7 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -46645,63 +46645,6 @@"supports_system_messages": true,"supports_tool_choice": true},- "fallback_generalizations": {- "rules": [- {- "name": "bedrock-claude-ids",- "pattern": "^(?:[a-z-]+\\.)?anthropic\\.claude-",- "description": "A Bedrock-syntax Claude id, for every version: anthropic.claude- at the start of the name, optionally behind a single dotted geo segment (us./eu./au./jp./apac./global./us-gov.). Anchored to the start because routing rules see the raw request string and provider inference feeds the proxy's provider/* wildcard access checks: an id under an unrecognized namespace such as bedrockz/anthropic.claude-... must stay unroutable rather than resolve to bedrock and slip through a bedrock/* key. Routes to bedrock before the bare-id Anthropic rule is consulted.",- "model_info": {- "litellm_provider": "bedrock"- }- },- {- "name": "anthropic-claude-ids",- "pattern": "^claude-[a-z]+-\\d+(?:[-.]\\d+)?(?:-\\d{8})?$",- "description": "A bare Claude family-major id with an optional minor and an optional 8-digit date suffix, anchored to the whole name, so claude-newfamily-5 routes like claude-newfamily-5-1 does. Routes an unmapped Claude id that carries no provider namespace to the Anthropic API.",- "model_info": {- "litellm_provider": "anthropic"- }- },- {- "name": "claude-family-baseline",- "pattern": "claude-[a-z]+-\\d+(?:[-.]\\d+)?(?:-\\d{8})?",- "description": "Any Claude family-major id with an optional minor and an optional 8-digit date suffix, under any provider namespace (bare, bedrock-dotted, vertex, databricks, ...), so bare majors like claude-newfamily-5 get the same baseline as claude-newfamily-5-1. Carries the model-family facts every Claude shares; it carries no pricing, so cost stays on the standard unpriced behavior rather than a guessed number.",- "model_info": {- "mode": "chat",- "max_input_tokens": 200000,- "max_output_tokens": 64000,- "max_tokens": 64000,- "supports_function_calling": true,- "supports_parallel_function_calling": true,- "supports_vision": true,- "supports_tool_choice": true,- "supports_assistant_prefill": true,- "supports_prompt_caching": true,- "supports_response_schema": true,- "supports_reasoning": true,- "supports_pdf_input": true,- "supports_system_messages": true- }- },- {- "name": "claude-adaptive-thinking",- "pattern": "claude-[a-z]+-(?:4[-._](?:[6-9]|[1-9]\\d)(?!\\d)|(?:[5-9]|[1-9]\\d)(?!\\d)(?:[-._]\\d{1,2}(?!\\d))?)",- "description": "Claude at version 4.6 or higher, in any id shape that contains claude-<family>-: minors 4.6 through 4.99, any later major-minor, and bare 5+ majors so a new family shaped like claude-fable-5 matches. Requiring the claude- prefix keeps non-Claude names such as team-sonnet-5-1 out. The minor is capped at two digits so an 8-digit date suffix such as claude-opus-4-20250514 is never read as a >= 4.6 minor. Turns on adaptive thinking for new versions and new families with no code change.",- "model_info": {- "supports_adaptive_thinking": true- }- },- {- "name": "claude-mid-conversation-system",- "pattern": "claude-[a-z]+-(?:4[-._](?:[89]|[1-9]\\d)(?!\\d)|(?:[5-9]|[1-9]\\d)(?!\\d)(?:[-._]\\d{1,2}(?!\\d))?)",- "description": "Claude at version 4.8 or higher, in any id shape that contains claude-<family>-: minors 4.8 through 4.99, any later major-minor, and bare 5+ majors so a new family like claude-fable-5 matches. Anthropic introduced mid-conversation system messages with Opus 4.8 and every newer Claude keeps them; 4.7 and below reject the system role inside messages.",- "model_info": {- "supports_mid_conversation_system": true- }- }- ]- },"xai/grok-4.20-0309-non-reasoning": {"cache_read_input_token_cost": 2e-07,"input_cost_per_token": 1.25e-06,@@ -46997,5 +46940,62 @@"audio"],"supports_audio_output": true+ },+ "fallback_generalizations": {+ "rules": [+ {+ "name": "bedrock-claude-ids",+ "pattern": "^(?:[a-z-]+\\.)?anthropic\\.claude-",+ "description": "A Bedrock-syntax Claude id, for every version: anthropic.claude- at the start of the name, optionally behind a single dotted geo segment (us./eu./au./jp./apac./global./us-gov.). Anchored to the start because routing rules see the raw request string and provider inference feeds the proxy's provider/* wildcard access checks: an id under an unrecognized namespace such as bedrockz/anthropic.claude-... must stay unroutable rather than resolve to bedrock and slip through a bedrock/* key. Routes to bedrock before the bare-id Anthropic rule is consulted.",+ "model_info": {+ "litellm_provider": "bedrock"+ }+ },+ {+ "name": "anthropic-claude-ids",+ "pattern": "^claude-[a-z]+-\\d+(?:[-.]\\d+)?(?:-\\d{8})?$",+ "description": "A bare Claude family-major id with an optional minor and an optional 8-digit date suffix, anchored to the whole name, so claude-newfamily-5 routes like claude-newfamily-5-1 does. Routes an unmapped Claude id that carries no provider namespace to the Anthropic API.",+ "model_info": {+ "litellm_provider": "anthropic"+ }+ },+ {+ "name": "claude-family-baseline",+ "pattern": "claude-[a-z]+-\\d+(?:[-.]\\d+)?(?:-\\d{8})?",+ "description": "Any Claude family-major id with an optional minor and an optional 8-digit date suffix, under any provider namespace (bare, bedrock-dotted, vertex, databricks, ...), so bare majors like claude-newfamily-5 get the same baseline as claude-newfamily-5-1. Carries the model-family facts every Claude shares; it carries no pricing, so cost stays on the standard unpriced behavior rather than a guessed number.",+ "model_info": {+ "mode": "chat",+ "max_input_tokens": 200000,+ "max_output_tokens": 64000,+ "max_tokens": 64000,+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_vision": true,+ "supports_tool_choice": true,+ "supports_assistant_prefill": true,+ "supports_prompt_caching": true,+ "supports_response_schema": true,+ "supports_reasoning": true,+ "supports_pdf_input": true,+ "supports_system_messages": true+ }+ },+ {+ "name": "claude-adaptive-thinking",+ "pattern": "claude-[a-z]+-(?:4[-._](?:[6-9]|[1-9]\\d)(?!\\d)|(?:[5-9]|[1-9]\\d)(?!\\d)(?:[-._]\\d{1,2}(?!\\d))?)",+ "description": "Claude at version 4.6 or higher, in any id shape that contains claude-<family>-: minors 4.6 through 4.99, any later major-minor, and bare 5+ majors so a new family shaped like claude-fable-5 matches. Requiring the claude- prefix keeps non-Claude names such as team-sonnet-5-1 out. The minor is capped at two digits so an 8-digit date suffix such as claude-opus-4-20250514 is never read as a >= 4.6 minor. Turns on adaptive thinking for new versions and new families with no code change.",+ "model_info": {+ "supports_adaptive_thinking": true+ }+ },+ {+ "name": "claude-mid-conversation-system",+ "pattern": "claude-[a-z]+-(?:4[-._](?:[89]|[1-9]\\d)(?!\\d)|(?:[5-9]|[1-9]\\d)(?!\\d)(?:[-._]\\d{1,2}(?!\\d))?)",+ "description": "Claude at version 4.8 or higher, in any id shape that contains claude-<family>-: minors 4.8 through 4.99, any later major-minor, and bare 5+ majors so a new family like claude-fable-5 matches. Anthropic introduced mid-conversation system messages with Opus 4.8 and every newer Claude keeps them; 4.7 and below reject the system role inside messages.",+ "model_info": {+ "supports_mid_conversation_system": true+ }+ }+ ]}}diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex 90491cefd3c..873b1eb24d7 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -46645,63 +46645,6 @@"supports_system_messages": true,"supports_tool_choice": true},- "fallback_generalizations": {- "rules": [- {- "name": "bedrock-claude-ids",- "pattern": "^(?:[a-z-]+\\.)?anthropic\\.claude-",- "description": "A Bedrock-syntax Claude id, for every version: anthropic.claude- at the start of the name, optionally behind a single dotted geo segment (us./eu./au./jp./apac./global./us-gov.). Anchored to the start because routing rules see the raw request string and provider inference feeds the proxy's provider/* wildcard access checks: an id under an unrecognized namespace such as bedrockz/anthropic.claude-... must stay unroutable rather than resolve to bedrock and slip through a bedrock/* key. Routes to bedrock before the bare-id Anthropic rule is consulted.",- "model_info": {- "litellm_provider": "bedrock"- }- },- {- "name": "anthropic-claude-ids",- "pattern": "^claude-[a-z]+-\\d+(?:[-.]\\d+)?(?:-\\d{8})?$",- "description": "A bare Claude family-major id with an optional minor and an optional 8-digit date suffix, anchored to the whole name, so claude-newfamily-5 routes like claude-newfamily-5-1 does. Routes an unmapped Claude id that carries no provider namespace to the Anthropic API.",- "model_info": {- "litellm_provider": "anthropic"- }- },- {- "name": "claude-family-baseline",- "pattern": "claude-[a-z]+-\\d+(?:[-.]\\d+)?(?:-\\d{8})?",- "description": "Any Claude family-major id with an optional minor and an optional 8-digit date suffix, under any provider namespace (bare, bedrock-dotted, vertex, databricks, ...), so bare majors like claude-newfamily-5 get the same baseline as claude-newfamily-5-1. Carries the model-family facts every Claude shares; it carries no pricing, so cost stays on the standard unpriced behavior rather than a guessed number.",- "model_info": {- "mode": "chat",- "max_input_tokens": 200000,- "max_output_tokens": 64000,- "max_tokens": 64000,- "supports_function_calling": true,- "supports_parallel_function_calling": true,- "supports_vision": true,- "supports_tool_choice": true,- "supports_assistant_prefill": true,- "supports_prompt_caching": true,- "supports_response_schema": true,- "supports_reasoning": true,- "supports_pdf_input": true,- "supports_system_messages": true- }- },- {- "name": "claude-adaptive-thinking",- "pattern": "claude-[a-z]+-(?:4[-._](?:[6-9]|[1-9]\\d)(?!\\d)|(?:[5-9]|[1-9]\\d)(?!\\d)(?:[-._]\\d{1,2}(?!\\d))?)",- "description": "Claude at version 4.6 or higher, in any id shape that contains claude-<family>-: minors 4.6 through 4.99, any later major-minor, and bare 5+ majors so a new family shaped like claude-fable-5 matches. Requiring the claude- prefix keeps non-Claude names such as team-sonnet-5-1 out. The minor is capped at two digits so an 8-digit date suffix such as claude-opus-4-20250514 is never read as a >= 4.6 minor. Turns on adaptive thinking for new versions and new families with no code change.",- "model_info": {- "supports_adaptive_thinking": true- }- },- {- "name": "claude-mid-conversation-system",- "pattern": "claude-[a-z]+-(?:4[-._](?:[89]|[1-9]\\d)(?!\\d)|(?:[5-9]|[1-9]\\d)(?!\\d)(?:[-._]\\d{1,2}(?!\\d))?)",- "description": "Claude at version 4.8 or higher, in any id shape that contains claude-<family>-: minors 4.8 through 4.99, any later major-minor, and bare 5+ majors so a new family like claude-fable-5 matches. Anthropic introduced mid-conversation system messages with Opus 4.8 and every newer Claude keeps them; 4.7 and below reject the system role inside messages.",- "model_info": {- "supports_mid_conversation_system": true- }- }- ]- },"xai/grok-4.20-0309-non-reasoning": {"cache_read_input_token_cost": 2e-07,"input_cost_per_token": 1.25e-06,@@ -46997,5 +46940,62 @@"audio"],"supports_audio_output": true+ },+ "fallback_generalizations": {+ "rules": [+ {+ "name": "bedrock-claude-ids",+ "pattern": "^(?:[a-z-]+\\.)?anthropic\\.claude-",+ "description": "A Bedrock-syntax Claude id, for every version: anthropic.claude- at the start of the name, optionally behind a single dotted geo segment (us./eu./au./jp./apac./global./us-gov.). Anchored to the start because routing rules see the raw request string and provider inference feeds the proxy's provider/* wildcard access checks: an id under an unrecognized namespace such as bedrockz/anthropic.claude-... must stay unroutable rather than resolve to bedrock and slip through a bedrock/* key. Routes to bedrock before the bare-id Anthropic rule is consulted.",+ "model_info": {+ "litellm_provider": "bedrock"+ }+ },+ {+ "name": "anthropic-claude-ids",+ "pattern": "^claude-[a-z]+-\\d+(?:[-.]\\d+)?(?:-\\d{8})?$",+ "description": "A bare Claude family-major id with an optional minor and an optional 8-digit date suffix, anchored to the whole name, so claude-newfamily-5 routes like claude-newfamily-5-1 does. Routes an unmapped Claude id that carries no provider namespace to the Anthropic API.",+ "model_info": {+ "litellm_provider": "anthropic"+ }+ },+ {+ "name": "claude-family-baseline",+ "pattern": "claude-[a-z]+-\\d+(?:[-.]\\d+)?(?:-\\d{8})?",+ "description": "Any Claude family-major id with an optional minor and an optional 8-digit date suffix, under any provider namespace (bare, bedrock-dotted, vertex, databricks, ...), so bare majors like claude-newfamily-5 get the same baseline as claude-newfamily-5-1. Carries the model-family facts every Claude shares; it carries no pricing, so cost stays on the standard unpriced behavior rather than a guessed number.",+ "model_info": {+ "mode": "chat",+ "max_input_tokens": 200000,+ "max_output_tokens": 64000,+ "max_tokens": 64000,+ "supports_function_calling": true,+ "supports_parallel_function_calling": true,+ "supports_vision": true,+ "supports_tool_choice": true,+ "supports_assistant_prefill": true,+ "supports_prompt_caching": true,+ "supports_response_schema": true,+ "supports_reasoning": true,+ "supports_pdf_input": true,+ "supports_system_messages": true+ }+ },+ {+ "name": "claude-adaptive-thinking",+ "pattern": "claude-[a-z]+-(?:4[-._](?:[6-9]|[1-9]\\d)(?!\\d)|(?:[5-9]|[1-9]\\d)(?!\\d)(?:[-._]\\d{1,2}(?!\\d))?)",+ "description": "Claude at version 4.6 or higher, in any id shape that contains claude-<family>-: minors 4.6 through 4.99, any later major-minor, and bare 5+ majors so a new family shaped like claude-fable-5 matches. Requiring the claude- prefix keeps non-Claude names such as team-sonnet-5-1 out. The minor is capped at two digits so an 8-digit date suffix such as claude-opus-4-20250514 is never read as a >= 4.6 minor. Turns on adaptive thinking for new versions and new families with no code change.",+ "model_info": {+ "supports_adaptive_thinking": true+ }+ },+ {+ "name": "claude-mid-conversation-system",+ "pattern": "claude-[a-z]+-(?:4[-._](?:[89]|[1-9]\\d)(?!\\d)|(?:[5-9]|[1-9]\\d)(?!\\d)(?:[-._]\\d{1,2}(?!\\d))?)",+ "description": "Claude at version 4.8 or higher, in any id shape that contains claude-<family>-: minors 4.8 through 4.99, any later major-minor, and bare 5+ majors so a new family like claude-fable-5 matches. Anthropic introduced mid-conversation system messages with Opus 4.8 and every newer Claude keeps them; 4.7 and below reject the system role inside messages.",+ "model_info": {+ "supports_mid_conversation_system": true+ }+ }+ ]}}