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(proxy): tolerate missing router_settings and non-list fallbacks in fallback resolution
Devin AIc064e576ee31
diff --git a/litellm/proxy/common_request_processing.py b/litellm/proxy/common_request_processing.pyindex 255bf3ebda2..9927320d795 100644--- a/litellm/proxy/common_request_processing.py+++ b/litellm/proxy/common_request_processing.py@@ -2121,14 +2121,14 @@ class ProxyBaseLLMRequestProcessing:fallbacks = None- key_router_settings: Final = user_api_key_dict.router_settings+ key_router_settings: Final = getattr(user_api_key_dict, "router_settings", None)if isinstance(key_router_settings, dict) and "fallbacks" in key_router_settings:fallbacks = key_router_settings["fallbacks"]if fallbacks is None:fallbacks = llm_router.fallbacks- if not fallbacks:+ if not isinstance(fallbacks, list) or not fallbacks:return Nonefallback_model_group, generic_fallback_idx = get_fallback_model_group(diff --git a/tests/test_litellm/proxy/test_common_request_processing.py b/tests/test_litellm/proxy/test_common_request_processing.pyindex 89e0799ba16..4beb73b3a81 100644--- a/tests/test_litellm/proxy/test_common_request_processing.py+++ b/tests/test_litellm/proxy/test_common_request_processing.py@@ -6449,7 +6449,9 @@ class TestPreCallWithFallbacksOnLocalRateLimit:mock_router = MagicMock()mock_router.fallbacks = None- with patch("litellm.proxy.common_request_processing.independent_snapshot") as snapshot_mock:+ with patch( # test-quality-ok: spying the snapshot seam is the only observable check that the no-fallback path skips it+ "litellm.proxy.common_request_processing.independent_snapshot"+ ) as snapshot_mock:with patch.object(processor,"common_processing_pre_call_logic",