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: Repair Merge Fallout In Router-Override Fallback Auth
Yuneng Jiangb484c51a1c95
diff --git a/litellm/proxy/auth/user_api_key_auth.py b/litellm/proxy/auth/user_api_key_auth.pyindex 682d57082da..9159a8ff9da 100644--- a/litellm/proxy/auth/user_api_key_auth.py+++ b/litellm/proxy/auth/user_api_key_auth.py@@ -11,7 +11,7 @@ import asyncioimport reimport secretsfrom datetime import datetime, timezone-from typing import Any, List, Optional, Tuple, Union, cast+from typing import Any, Iterator, List, Optional, Tuple, Union, castimport fastapifrom fastapi import HTTPException, Request, WebSocket, status@@ -2271,10 +2271,6 @@ async def _enforce_key_and_fallback_model_access(route=route,request=request,)- fallback_models = cast(- Optional[List[ALL_FALLBACK_MODEL_VALUES]],- request_data.get("fallbacks", None),- )if model is not None:await can_key_call_model(diff --git a/tests/test_litellm/proxy/auth/test_router_override_fallback_auth.py b/tests/test_litellm/proxy/auth/test_router_override_fallback_auth.pyindex 28808ffad83..fc0e9aec501 100644--- a/tests/test_litellm/proxy/auth/test_router_override_fallback_auth.py+++ b/tests/test_litellm/proxy/auth/test_router_override_fallback_auth.py@@ -94,6 +94,7 @@ async def test_router_override_fallbacks_validated_against_key_allowlist():valid_token=valid_token,request_data=request_data,route="/v1/chat/completions",+ request=None,llm_model_list=None,llm_router=None,)@@ -144,6 +145,7 @@ async def test_router_override_all_fallback_fields_validated(fallback_field):valid_token=valid_token,request_data=request_data,route="/v1/chat/completions",+ request=None,llm_model_list=None,llm_router=None,)@@ -190,6 +192,7 @@ async def test_top_level_fallback_fields_validated(fallback_field):valid_token=valid_token,request_data=request_data,route="/v1/chat/completions",+ request=None,llm_model_list=None,llm_router=None,)@@ -226,6 +229,7 @@ async def test_router_override_without_fallbacks_does_not_break_auth():valid_token=valid_token,request_data=request_data,route="/v1/chat/completions",+ request=None,llm_model_list=None,llm_router=None,)