diff --git a/litellm/integrations/callback_configs.json b/litellm/integrations/callback_configs.json index 7d452d9ef0..88f7908e9a 100644 --- a/litellm/integrations/callback_configs.json +++ b/litellm/integrations/callback_configs.json @@ -42,21 +42,21 @@ "description": "Braintrust Logging Integration" }, { - "id": "custom_callback_api", + "id": "generic_api", "displayName": "Custom Callback API", "logo": "custom.svg", "supports_key_team_logging": true, "dynamic_params": { - "custom_callback_api_url": { + "GENERIC_LOGGER_ENDPOINT": { "type": "text", "ui_name": "Callback URL", "description": "Your custom webhook/API endpoint URL to receive logs", "required": true }, - "custom_callback_api_headers": { + "GENERIC_LOGGER_HEADERS": { "type": "text", - "ui_name": "Headers (JSON)", - "description": "Custom HTTP headers as JSON string (e.g., {\"Authorization\": \"Bearer token\"})", + "ui_name": "Headers", + "description": "Custom HTTP headers as a comma-separated string (e.g., Authorization: Bearer token, Content-Type: application/json)", "required": false } }, diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 9edc93bfff..964c6c4e40 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -2577,7 +2577,7 @@ class AllCallbacks(LiteLLMPydanticObjectBase): custom_callback_api: CallbackOnUI = CallbackOnUI( litellm_callback_name="custom_callback_api", - litellm_callback_params=["GENERIC_LOGGER_ENDPOINT"], + litellm_callback_params=["GENERIC_LOGGER_ENDPOINT", "GENERIC_LOGGER_HEADER"], ui_callback_name="Custom Callback API", ) diff --git a/litellm/proxy/common_utils/callback_utils.py b/litellm/proxy/common_utils/callback_utils.py index 9e88bccb73..4beec52c07 100644 --- a/litellm/proxy/common_utils/callback_utils.py +++ b/litellm/proxy/common_utils/callback_utils.py @@ -6,9 +6,6 @@ from litellm._logging import verbose_proxy_logger from litellm.integrations.custom_logger import CustomLogger from litellm.proxy._types import CommonProxyErrors, LiteLLMPromptInjectionParams from litellm.proxy.types_utils.utils import get_instance_fn -from litellm.proxy.common_utils.encrypt_decrypt_utils import ( - decrypt_value_helper, -) from litellm.types.utils import ( StandardLoggingGuardrailInformation, StandardLoggingPayload, @@ -434,11 +431,7 @@ def process_callback(_callback: str, callback_type: str, environment_variables: if env_variable is None: env_vars_dict[_var] = None else: - # decode + decrypt the value - decrypted_value = decrypt_value_helper( - value=env_variable, key=_var - ) - env_vars_dict[_var] = decrypted_value + env_vars_dict[_var] = env_variable return { "name": _callback, diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index c1a5fd6c92..13adda2f1b 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -9476,7 +9476,7 @@ async def get_config(): # noqa: PLR0915 _litellm_settings = config_data.get("litellm_settings", {}) _general_settings = config_data.get("general_settings", {}) environment_variables = config_data.get("environment_variables", {}) - + _success_callbacks = _litellm_settings.get("success_callback", []) _failure_callbacks = _litellm_settings.get("failure_callback", []) _success_and_failure_callbacks = _litellm_settings.get("callbacks", []) diff --git a/tests/test_litellm/proxy/common_utils/test_callback_utils.py b/tests/test_litellm/proxy/common_utils/test_callback_utils.py index d51437fc84..985e8d20be 100644 --- a/tests/test_litellm/proxy/common_utils/test_callback_utils.py +++ b/tests/test_litellm/proxy/common_utils/test_callback_utils.py @@ -37,13 +37,9 @@ def test_get_remaining_tokens_and_requests_from_request_data(): "litellm.proxy.common_utils.callback_utils.CustomLogger.get_callback_env_vars", return_value=["API_KEY", "MISSING_VAR"], ) -@patch( - "litellm.proxy.common_utils.callback_utils.decrypt_value_helper", - side_effect=lambda value, key: f"decrypted-{key}", -) -def test_process_callback_with_env_vars(mock_decrypt, mock_get_env_vars): +def test_process_callback_with_env_vars(mock_get_env_vars): environment_variables = { - "API_KEY": "ENC_VALUE", + "API_KEY": "PLAIN_VALUE", "UNUSED": "SHOULD_BE_IGNORED", } @@ -56,7 +52,7 @@ def test_process_callback_with_env_vars(mock_decrypt, mock_get_env_vars): assert result["name"] == "my_callback" assert result["type"] == "input" assert result["variables"] == { - "API_KEY": "decrypted-API_KEY", + "API_KEY": "PLAIN_VALUE", "MISSING_VAR": None, } diff --git a/tests/test_litellm/proxy/test_proxy_server.py b/tests/test_litellm/proxy/test_proxy_server.py index e75b87e1c8..6be6f1e3d0 100644 --- a/tests/test_litellm/proxy/test_proxy_server.py +++ b/tests/test_litellm/proxy/test_proxy_server.py @@ -252,13 +252,13 @@ def test_get_config_custom_callback_api_env_vars(monkeypatch): """ from litellm.proxy.proxy_server import app, proxy_config, user_api_key_auth - # Mock config with custom_callback_api enabled and custom env vars present + # Mock config with custom_callback_api enabled and generic logger env vars present config_data = { "litellm_settings": {"success_callback": ["custom_callback_api"]}, "general_settings": {}, "environment_variables": { - "custom_callback_api_url": "https://callback.example.com", - "custom_callback_api_headers": "Auth: token", + "GENERIC_LOGGER_ENDPOINT": "https://callback.example.com", + "GENERIC_LOGGER_HEADER": "Auth: token", }, } @@ -288,10 +288,9 @@ def test_get_config_custom_callback_api_env_vars(monkeypatch): assert custom_cb is not None assert custom_cb["variables"] == { - "custom_callback_api_url": "https://callback.example.com", - "custom_callback_api_headers": "Auth: token", + "GENERIC_LOGGER_ENDPOINT": "https://callback.example.com", + "GENERIC_LOGGER_HEADER": "Auth: token", } - assert "GENERIC_LOGGER_ENDPOINT" not in custom_cb["variables"] # Mock Prisma