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
fix(proxy): move credentials hint helper into a leaf html_forms module to clear CodeQL cyclic import
yassinc8440b563888
diff --git a/litellm/proxy/common_utils/html_forms/default_credentials_hint.py b/litellm/proxy/common_utils/html_forms/default_credentials_hint.pynew file mode 100644index 00000000000..e3ed948501b--- /dev/null+++ b/litellm/proxy/common_utils/html_forms/default_credentials_hint.py@@ -0,0 +1,10 @@+import os+from collections.abc import Mapping+++def should_hide_default_credentials_hint(general_settings: Mapping[str, object]) -> bool:+ return (+ os.getenv("LITELLM_HIDE_DEFAULT_CREDENTIALS_HINT", "false").lower() == "true"+ or general_settings.get("hide_default_credentials_hint", False) is True+ or bool(os.getenv("UI_PASSWORD"))+ )diff --git a/litellm/proxy/discovery_endpoints/ui_discovery_endpoints.py b/litellm/proxy/discovery_endpoints/ui_discovery_endpoints.pyindex e0efe9dea2c..8b042d18cd0 100644--- a/litellm/proxy/discovery_endpoints/ui_discovery_endpoints.py+++ b/litellm/proxy/discovery_endpoints/ui_discovery_endpoints.py@@ -1,10 +1,10 @@#### Analytics Endpoints #####import os-from collections.abc import Mappingfrom typing import Finalfrom fastapi import APIRouter+from litellm.proxy.common_utils.html_forms.default_credentials_hint import should_hide_default_credentials_hintfrom litellm.types.proxy.discovery_endpoints.ui_discovery_endpoints import (UiDiscoveryEndpoints,)@@ -12,14 +12,6 @@ from litellm.types.proxy.discovery_endpoints.ui_discovery_endpoints import (router: Final = APIRouter()-def should_hide_default_credentials_hint(general_settings: Mapping[str, object]) -> bool:- return (- os.getenv("LITELLM_HIDE_DEFAULT_CREDENTIALS_HINT", "false").lower() == "true"- or general_settings.get("hide_default_credentials_hint", False) is True- or bool(os.getenv("UI_PASSWORD"))- )--@router.get("/.well-known/litellm-ui-config", response_model=UiDiscoveryEndpoints)@router.get("/litellm/.well-known/litellm-ui-config", response_model=UiDiscoveryEndpoints) # if mounted at root pathasync def get_ui_config():diff --git a/litellm/proxy/management_endpoints/ui_sso.py b/litellm/proxy/management_endpoints/ui_sso.pyindex 6a775998f4f..091dccf1433 100644--- a/litellm/proxy/management_endpoints/ui_sso.py+++ b/litellm/proxy/management_endpoints/ui_sso.py@@ -101,12 +101,12 @@ from litellm.proxy.common_utils.admin_ui_utils import (admin_ui_disabled,show_missing_vars_in_env,)+from litellm.proxy.common_utils.html_forms.default_credentials_hint import should_hide_default_credentials_hintfrom litellm.proxy.common_utils.html_forms.jwt_display_template import (jwt_display_template,)from litellm.proxy.common_utils.html_forms.ui_login import build_ui_login_formfrom litellm.proxy.common_utils.user_api_key_cache import UserApiKeyCache-from litellm.proxy.discovery_endpoints.ui_discovery_endpoints import should_hide_default_credentials_hintfrom litellm.proxy.management_endpoints.internal_user_endpoints import new_userfrom litellm.proxy.management_endpoints.sso import CustomMicrosoftSSOfrom litellm.proxy.management_endpoints.sso.id_jag_assertion_capture import (diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex 230513d7eb4..fce468aa564 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -365,6 +365,7 @@ from litellm.proxy.common_utils.healthy_model_filter import (get_hidden_unhealthy_model_names,is_healthy_only_listing_default,)+from litellm.proxy.common_utils.html_forms.default_credentials_hint import should_hide_default_credentials_hintfrom litellm.proxy.common_utils.html_forms.ui_login import build_ui_login_formfrom litellm.proxy.common_utils.http_parsing_utils import (_read_request_body,@@ -450,7 +451,6 @@ from litellm.proxy.discovery_endpoints import (agent_skills_discovery_router,ui_discovery_endpoints_router,)-from litellm.proxy.discovery_endpoints.ui_discovery_endpoints import should_hide_default_credentials_hintfrom litellm.proxy.fine_tuning_endpoints.endpoints import router as fine_tuning_routerfrom litellm.proxy.fine_tuning_endpoints.endpoints import set_fine_tuning_configfrom litellm.proxy.google_endpoints.endpoints import router as google_router