diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index ddcdcf5f04..95739834a9 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -2149,6 +2149,10 @@ class ConfigGeneralSettings(LiteLLMPydanticObjectBase): None, description="If True, models and config are stored in and loaded from the database. Default is False.", ) + forward_client_headers_to_llm_api: Optional[bool] = Field( + None, + description="If True, forwards client headers (e.g. Authorization) to the LLM API. Required for Claude Code with Max subscription.", + ) class ConfigYAML(LiteLLMPydanticObjectBase): diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 1e62be55bd..75d7fcc4f3 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -11387,6 +11387,7 @@ async def get_config_list( "mcp_internal_ip_ranges": {"type": "List"}, "mcp_trusted_proxy_ranges": {"type": "List"}, "always_include_stream_usage": {"type": "Boolean"}, + "forward_client_headers_to_llm_api": {"type": "Boolean"}, } return_val = [] diff --git a/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py b/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py index 6d32310940..b465d13bc7 100644 --- a/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py +++ b/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py @@ -88,6 +88,11 @@ class UISettings(BaseModel): description="If true, requires authentication for accessing the public AI Hub." ) + forward_client_headers_to_llm_api: bool = Field( + default=False, + description="If enabled, forwards client headers (e.g. Authorization) to the LLM API. Required for Claude Code with Max subscription.", + ) + class UISettingsResponse(SettingsResponse): """Response model for UI settings""" @@ -101,6 +106,7 @@ ALLOWED_UI_SETTINGS_FIELDS = { "disable_team_admin_delete_team_user", "enabled_ui_pages_internal_users", "require_auth_for_public_ai_hub", + "forward_client_headers_to_llm_api", } @@ -937,6 +943,15 @@ async def get_ui_settings(): k: v for k, v in ui_settings.items() if k in ALLOWED_UI_SETTINGS_FIELDS } + # Sync forward_client_headers_to_llm_api into general_settings so the proxy + # picks it up at runtime (covers server restart scenarios). + if "forward_client_headers_to_llm_api" in ui_settings: + from litellm.proxy.proxy_server import general_settings + + general_settings["forward_client_headers_to_llm_api"] = ui_settings[ + "forward_client_headers_to_llm_api" + ] + # Build config-like object for schema helper config: Dict[str, Any] = {"litellm_settings": {"ui_settings": ui_settings}} @@ -1000,6 +1015,15 @@ async def update_ui_settings( }, ) + # Sync forward_client_headers_to_llm_api to general_settings so the proxy + # picks it up at runtime (general_settings is checked in pre-call utils). + if "forward_client_headers_to_llm_api" in ui_settings: + from litellm.proxy.proxy_server import general_settings + + general_settings["forward_client_headers_to_llm_api"] = ui_settings[ + "forward_client_headers_to_llm_api" + ] + return { "message": "UI settings updated successfully", "status": "success", diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/UISettings.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/UISettings.tsx index a43f0e9d42..d99053d0a4 100644 --- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/UISettings.tsx +++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/UISettings.tsx @@ -16,6 +16,7 @@ export default function UISettings() { const property = schema?.properties?.disable_model_add_for_internal_users; const disableTeamAdminDeleteProperty = schema?.properties?.disable_team_admin_delete_team_user; const requireAuthForPublicAIHubProperty = schema?.properties?.require_auth_for_public_ai_hub; + const forwardClientHeadersProperty = schema?.properties?.forward_client_headers_to_llm_api; const enabledPagesProperty = schema?.properties?.enabled_ui_pages_internal_users; const values = data?.values ?? {}; const isDisabledForInternalUsers = Boolean(values.disable_model_add_for_internal_users); @@ -60,6 +61,20 @@ export default function UISettings() { }); }; + const handleToggleForwardClientHeaders = (checked: boolean) => { + updateSettings( + { forward_client_headers_to_llm_api: checked }, + { + onSuccess: () => { + NotificationManager.success("UI settings updated successfully"); + }, + onError: (error) => { + NotificationManager.fromBackend(error); + }, + }, + ); + }; + const handleToggleRequireAuthForPublicAIHub = (checked: boolean) => { updateSettings( { require_auth_for_public_ai_hub: checked }, @@ -144,6 +159,23 @@ export default function UISettings() { + + + + Forward client headers to LLM API + + {forwardClientHeadersProperty?.description ?? + "If enabled, forwards client headers (e.g. Authorization) to the LLM API. Required for Claude Code with Max subscription."} + + + + {/* Page Visibility for Internal Users */}