diff --git a/litellm/types/management_endpoints/router_settings_endpoints.py b/litellm/types/management_endpoints/router_settings_endpoints.py index dfb513cdd5f..72d1cd2f30d 100644 --- a/litellm/types/management_endpoints/router_settings_endpoints.py +++ b/litellm/types/management_endpoints/router_settings_endpoints.py @@ -243,13 +243,15 @@ ROUTER_SETTINGS_FIELDS: List[RouterSettingsField] = [ "that cached the prompt." ), field_default=[], + # "forward_client_headers_by_model_group" is excluded: it's a literal in the + # OptionalPreCallChecks type union, but add_optional_pre_call_checks has no + # handler for it, so selecting it from the UI would silently do nothing. options=[ "prompt_caching", "router_budget_limiting", "responses_api_deployment_check", "deployment_affinity", "session_affinity", - "forward_client_headers_by_model_group", "enforce_model_rate_limits", "encrypted_content_affinity", ], diff --git a/tests/test_litellm/proxy/management_endpoints/test_router_settings_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_router_settings_endpoints.py index 348d74a36fd..a924e2a49b8 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_router_settings_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_router_settings_endpoints.py @@ -97,6 +97,27 @@ class TestRouterSettingsEndpoints: assert field is not None assert "prompt_caching" in field["options"] + @pytest.mark.asyncio + async def test_get_router_fields_excludes_unimplemented_forward_client_headers_check(self): + """ + Regression test: "forward_client_headers_by_model_group" is a literal in the + OptionalPreCallChecks type union, but Router.add_optional_pre_call_checks has + no handler for it - selecting it from the Admin UI's multi-select would save + successfully and show as enabled while doing nothing. It must not be offered + as an option until it's actually implemented. + """ + response = client.get( + "/router/fields", headers={"Authorization": "Bearer sk-1234"} + ) + assert response.status_code == 200 + + fields = response.json()["fields"] + field = next( + (f for f in fields if f["field_name"] == "optional_pre_call_checks"), None + ) + assert field is not None + assert "forward_client_headers_by_model_group" not in field["options"] + @pytest.mark.asyncio async def test_get_router_settings_includes_routing_groups_from_live_router( self, monkeypatch