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
Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_lit5285_login_rate_limit
Yucheng Zhub1602732189f
diff --cc litellm/proxy/proxy_server.pyindex c6a1dc4cdb7,70bf8fd0554..d9d647c5f18--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@@ -291,9 -296,9 +296,10 @@@ from litellm.proxy.auth.auth_utils impois_request_body_safe,warn_once_if_custom_auth_skips_common_checks,)+ from litellm.proxy.auth.fallback_model_access import router_fallback_access_checkfrom litellm.proxy.auth.handle_jwt import JWTHandlerfrom litellm.proxy.auth.litellm_license import LicenseCheck+from litellm.proxy.auth.login_throttle import LoginThrottlefrom litellm.proxy.auth.model_checks import (expand_wildcard_deployments_for_model_info,get_all_fallbacks,diff --cc tests/test_litellm/proxy/test_proxy_server.pyindex a39fec7f523,43280258153..3128d58b566--- a/tests/test_litellm/proxy/test_proxy_server.py+++ b/tests/test_litellm/proxy/test_proxy_server.py@@@ -11427,30 -12107,16 +12108,45 @@@ async def test_authoritative_floor_spen)+async def test_login_throttle_settings_are_not_hot_applied_from_the_database():+ """LIT-5285: a stored sign-in limit does not take effect on a live worker.++ _update_general_settings copies an allowlist of keys out of the DB row on every config+ poll. Adding these to it would let a stored value outrank config.yaml without a restart,+ so an operator locked out by a bad value could not fix it by editing YAML and restarting.+ """+ import litellm.proxy.proxy_server as ps+ from litellm.proxy.proxy_server import ProxyConfig++ original = dict(ps.general_settings)+ try:+ ps.general_settings.clear()+ await ProxyConfig()._update_general_settings(+ db_general_settings={+ "max_failed_login_attempts": 999,+ "max_failed_login_attempts_per_source": 999,+ "failed_login_window_seconds": 1,+ }+ )+ assert "max_failed_login_attempts" not in ps.general_settings+ assert "max_failed_login_attempts_per_source" not in ps.general_settings+ assert "failed_login_window_seconds" not in ps.general_settings+ finally:+ ps.general_settings.clear()+ ps.general_settings.update(original)+++++ @pytest.mark.asyncio+ async def test_load_config_router_authorizes_fallback_targets_against_the_calling_key(tmp_path):+ from litellm.proxy.auth.fallback_model_access import router_fallback_access_check+ from litellm.proxy.proxy_server import ProxyConfig++ config_file = tmp_path / "config.yaml"+ config_file.write_text(+ yaml.dump({"model_list": [{"model_name": "m", "litellm_params": {"model": "openai/m", "api_key": "k"}}]})+ )++ router, _, _ = await ProxyConfig().load_config(router=None, config_file_path=str(config_file))++ assert router.fallback_access_check is router_fallback_access_checkdiff --cc ui/litellm-dashboard/src/lib/http/schema.d.tsindex 62ba7ce8b95,e944062e15e..684ddb982a6--- a/ui/litellm-dashboard/src/lib/http/schema.d.ts+++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts@@@ -24150,11 -25466,11 +25466,16 @@@ export interface components* @default false*/enable_public_model_hub: boolean;+ /**+ * Enforce Fallback Model Access+ * @description If True, router fallbacks configured in router_settings are only attempted when the calling key (and its team and project) is allowed to call the fallback model; unauthorized fallback targets are skipped and the primary model's error is returned. Default is False.+ */+ enforce_fallback_model_access?: boolean | null;+ /**+ * Failed Login Window Seconds+ * @description Fixed window in seconds over which failed Admin UI sign-in attempts are counted. The window starts at the first failure and is not extended by later ones. Set under `general_settings` in config.yaml. Defaults to 900+ */+ failed_login_window_seconds?: number | null;/*** Forward Client Headers To Llm Api* @description If True, forwards client headers (e.g. Authorization) to the LLM API. Required for Claude Code with Max subscription.