diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 2420a47aa20..34097ef6d44 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -17097,7 +17097,13 @@ async def get_config( _added_normalized_names: Final[set] = set(_configured_callback_names_normalized) # Append runtime-only rows (those not in config). + # Filter out internal proxy hooks (names starting with _PROXY or known internal names). + _internal_callback_prefixes: Final[tuple] = ("_PROXY", "_Async", "ShadowEval", "ServiceLogging", "SkillsInjection", "ResponsesID") for _runtime_cb_name, _runtime_cb_type in _runtime_items: + # Skip internal proxy callbacks (these are infrastructure, not user-configured). + if isinstance(_runtime_cb_name, str) and any(_runtime_cb_name.startswith(p) for p in _internal_callback_prefixes): + continue + _normalized_runtime = _normalize_callback_alias(_runtime_cb_name) # Skip if this callback is in config or already appended. if _normalized_runtime not in _added_normalized_names: diff --git a/tests/proxy_unit_tests/test_proxy_server.py b/tests/proxy_unit_tests/test_proxy_server.py index 47554913419..e39a5bcb360 100644 --- a/tests/proxy_unit_tests/test_proxy_server.py +++ b/tests/proxy_unit_tests/test_proxy_server.py @@ -2922,18 +2922,21 @@ async def test_get_config_callbacks_with_all_types(client_no_auth): callbacks = result["callbacks"] - # Verify we have all 5 callbacks (2 success + 1 failure + 2 success_and_failure) - assert len(callbacks) == 5 + # Filter out internal/runtime-only callbacks (read_only=True) to test configured callbacks + configured_callbacks = [cb for cb in callbacks if not cb.get("read_only", False)] - # Group callbacks by type - success_callbacks = [cb for cb in callbacks if cb.get("type") == "success"] - failure_callbacks = [cb for cb in callbacks if cb.get("type") == "failure"] + # Verify we have all 5 configured callbacks (2 success + 1 failure + 2 success_and_failure) + assert len(configured_callbacks) == 5 + + # Group callbacks by type (configured only) + success_callbacks = [cb for cb in configured_callbacks if cb.get("type") == "success"] + failure_callbacks = [cb for cb in configured_callbacks if cb.get("type") == "failure"] success_and_failure_callbacks = [ - cb for cb in callbacks if cb.get("type") == "success_and_failure" + cb for cb in configured_callbacks if cb.get("type") == "success_and_failure" ] - # Verify all callbacks have required fields - for callback in callbacks: + # Verify all configured callbacks have required fields + for callback in configured_callbacks: assert "name" in callback assert "variables" in callback assert "type" in callback