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
feat(ui): add forward_client_headers_to_llm_api toggle to general settings (#21776)
shin-bot-litellm32b09b29fc7e
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex ddcdcf5f048..95739834a9a 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.pyindex 1e62be55bdf..75d7fcc4f3a 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.pyindex 6d32310940b..b465d13bc70 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 helperconfig: 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.tsxindex a43f0e9d42d..d99053d0a47 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() {</Space></Space>+ <Space align="start" size="middle">+ <Switch+ checked={Boolean(values.forward_client_headers_to_llm_api)}+ disabled={isUpdating}+ loading={isUpdating}+ onChange={handleToggleForwardClientHeaders}+ aria-label={forwardClientHeadersProperty?.description ?? "Forward client headers to LLM API"}+ />+ <Space direction="vertical" size={4}>+ <Typography.Text strong>Forward client headers to LLM API</Typography.Text>+ <Typography.Text type="secondary">+ {forwardClientHeadersProperty?.description ??+ "If enabled, forwards client headers (e.g. Authorization) to the LLM API. Required for Claude Code with Max subscription."}+ </Typography.Text>+ </Space>+ </Space>+<Divider />{/* Page Visibility for Internal Users */}