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] Sync UI settings into general_settings on proxy startup
yuneng-jiangd904b92f5a64
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex ad31ff33802..d4f405d0f64 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -885,6 +885,9 @@ async def proxy_startup_event(app: FastAPI): # noqa: PLR0915await ProxyStartupEvent._update_default_team_member_budget()+ ## SYNC UI SETTINGS ##+ await ProxyStartupEvent._sync_ui_settings_to_general_settings()+# Start background health checks AFTER models are loaded and index is builtif use_background_health_checks:asyncio.create_task(@@ -5639,6 +5642,41 @@ class ProxyStartupEvent:teams=teams_pydantic_obj, user_api_key_dict=UserAPIKeyAuth(token=hash_token(master_key)) # type: ignore)+ @classmethod+ async def _sync_ui_settings_to_general_settings(cls):+ """+ Load persisted UI settings from the database and sync runtime flags+ into general_settings so they take effect immediately after startup.+ """+ try:+ import json++ from litellm.proxy.ui_crud_endpoints.proxy_setting_endpoints import (+ _RUNTIME_GENERAL_SETTINGS_FLAGS,+ )++ db_record = await prisma_client.db.litellm_uisettings.find_unique(+ where={"id": "ui_settings"}+ )+ if db_record and db_record.ui_settings:+ raw = db_record.ui_settings+ ui_settings = json.loads(raw) if isinstance(raw, str) else dict(raw)+ flags_to_sync = {+ k: ui_settings[k]+ for k in _RUNTIME_GENERAL_SETTINGS_FLAGS+ if k in ui_settings+ }+ if flags_to_sync:+ general_settings.update(flags_to_sync)+ verbose_proxy_logger.info(+ "Synced UI settings to general_settings on startup: %s",+ list(flags_to_sync.keys()),+ )+ except Exception as e:+ verbose_proxy_logger.debug(+ "UI settings sync on startup skipped or failed: %s", e+ )+@classmethodasync def initialize_scheduled_background_jobs( # noqa: PLR0915cls,