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(proxy): gate the Global Control Plane worker registry on an enterprise license (#36996)
Yassin Kortam5a50fe0b46d6
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex 385f39e02a4..934ac9ac3d7 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -38,6 +38,7 @@ from litellm.types.mcp import (MCPTransportType,)from litellm.types.mcp_server.mcp_server_manager import MCPInfo+from litellm.types.proxy.control_plane_endpoints import WorkerRegistryEntryfrom litellm.types.router import RouterErrors, UpdateRouterConfigfrom litellm.types.secret_managers.main import KeyManagementSystemfrom litellm.types.utils import (@@ -2332,6 +2333,15 @@ class ConfigGeneralSettings(LiteLLMPydanticObjectBase):"borrowing the `cache_params` Redis and over the REDIS_* env fallback"),)+ control_plane_url: str | None = Field(+ None,+ description=(+ "Global Control Plane: URL of the control plane whose admin UI manages this instance. "+ "Enables /v3/login and /v3/login/exchange on this instance so that UI can authenticate "+ "against it cross-origin, and restricts the SSO return_to origin to that URL. "+ "No state is shared with the control plane"+ ),+ )allow_cli_sso_verification_uri_complete: bool | None = Field(None,description="opt-in to RFC 8628 verification_uri_complete for the CLI SSO device flow, pre-filling the user_code in the browser. Off by default; intended for same-host clients where the device that starts the flow and the browser run on the same machine",@@ -2629,6 +2639,14 @@ class ConfigYAML(LiteLLMPydanticObjectBase):description="litellm Module settings. See __init__.py for all, example litellm.drop_params=True, litellm.set_verbose=True, litellm.api_base, litellm.cache",)general_settings: ConfigGeneralSettings | None = None+ worker_registry: list[WorkerRegistryEntry] | None = Field(+ None,+ description=(+ "Global Control Plane: the independent proxy instances this instance's admin UI manages. "+ "Setting it makes this a control plane, which serves the UI and does not route LLM requests. "+ "Enterprise-only"+ ),+ )router_settings: UpdateRouterConfig | None = Field(None,description="litellm router object settings. See router.py __init__ for all, example router.num_retries=5, router.timeout=5, router.max_retries=5, router.retry_after=5",diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.pyindex 377963f1b91..10ee2e10a39 100644--- a/litellm/proxy/proxy_server.py+++ b/litellm/proxy/proxy_server.py@@ -5427,9 +5427,11 @@ class ProxyConfig:# Load vector stores from configlitellm.vector_store_registry.load_vector_stores_from_config(vector_store_registry_config)- ## WORKER REGISTRY (Control Plane)+ ## WORKER REGISTRY (Global Control Plane)worker_registry_config: Final = config.get("worker_registry", None)if worker_registry_config:+ if premium_user is not True:+ raise ValueError("Trying to use `worker_registry`" + CommonProxyErrors.not_premium_user.value)self.worker_registry = [WorkerRegistryEntry(**e) for e in worker_registry_config]else:self.worker_registry = []diff --git a/tests/test_litellm/proxy/proxy_server/test_proxy_config.py b/tests/test_litellm/proxy/proxy_server/test_proxy_config.pyindex f70be17eb95..17dd486763d 100644--- a/tests/test_litellm/proxy/proxy_server/test_proxy_config.py+++ b/tests/test_litellm/proxy/proxy_server/test_proxy_config.py@@ -17,6 +17,7 @@ from unittest.mock import AsyncMock, MagicMockimport pytestimport litellm+from litellm.proxy._types import CommonProxyErrorsfrom litellm.proxy.proxy_server import (ProxyConfig,_is_remote_module_url,@@ -1209,7 +1210,8 @@ async def test_ProxyConfig__init_non_llm_configs_empty_config():@pytest.mark.asyncio-async def test_ProxyConfig__init_non_llm_configs_invalid_worker_registry_raises():+async def test_ProxyConfig__init_non_llm_configs_premium_invalid_worker_registry_raises(monkeypatch):+ monkeypatch.setattr("litellm.proxy.proxy_server.premium_user", True)pc = ProxyConfig()with pytest.raises(Exception):await pc._init_non_llm_configs(@@ -1218,6 +1220,53 @@ async def test_ProxyConfig__init_non_llm_configs_invalid_worker_registry_raises()+async def test_ProxyConfig__init_non_llm_configs_worker_registry_requires_premium(monkeypatch):+ monkeypatch.setattr("litellm.proxy.proxy_server.premium_user", False)+ pc = ProxyConfig()+ with pytest.raises(ValueError) as exc_info:+ await pc._init_non_llm_configs(+ config={+ "worker_registry": [+ {"worker_id": "worker-a", "name": "Worker A", "url": "http://localhost:4001"}+ ]+ },+ config_file_path=None,+ )+ message = str(exc_info.value)+ assert "worker_registry" in message+ assert CommonProxyErrors.not_premium_user.value in message+ assert pc.worker_registry == []+++async def test_ProxyConfig__init_non_llm_configs_worker_registry_loads_for_premium(monkeypatch):+ monkeypatch.setattr("litellm.proxy.proxy_server.premium_user", True)+ pc = ProxyConfig()+ await pc._init_non_llm_configs(+ config={+ "worker_registry": [+ {"worker_id": "worker-a", "name": "Worker A", "url": "http://localhost:4001"},+ {"worker_id": "worker-b", "name": "Worker B", "url": "https://worker-b.example.com"},+ ]+ },+ config_file_path=None,+ )+ assert [(w.worker_id, w.name, w.url) for w in pc.worker_registry] == [+ ("worker-a", "Worker A", "http://localhost:4001"),+ ("worker-b", "Worker B", "https://worker-b.example.com"),+ ]++[email protected]("premium", [True, False])+async def test_ProxyConfig__init_non_llm_configs_no_worker_registry_is_never_gated(monkeypatch, premium):+ monkeypatch.setattr("litellm.proxy.proxy_server.premium_user", premium)+ pc = ProxyConfig()+ await pc._init_non_llm_configs(config={}, config_file_path=None)+ assert pc.worker_registry == []++# ---------------------------------------------------------------------------# ProxyConfig._init_policy_engine# ---------------------------------------------------------------------------diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.tsindex 3b4b96bdd4e..0c128d9815b 100644--- a/ui/litellm-dashboard/src/lib/http/schema.d.ts+++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts@@ -23611,6 +23611,11 @@ export interface components {* @description proxy level default model for all chat completion calls*/completion_model?: string | null;+ /**+ * Control Plane Url+ * @description Global Control Plane: URL of the control plane whose admin UI manages this instance. Enables /v3/login and /v3/login/exchange on this instance so that UI can authenticate against it cross-origin, and restricts the SSO return_to origin to that URL. No state is shared with the control plane+ */+ control_plane_url?: string | null;/** @description standalone Redis for cross-pod coordination (tpm/rpm rate limits, spend tracking, pod lock manager, shared health checks), configured independently of the response-cache backend; takes precedence over borrowing the `cache_params` Redis and over the REDIS_* env fallback */coordination_redis?: components["schemas"]["CoordinationRedisParams"] | null;/**@@ -23964,6 +23969,11 @@ export interface components {model_list?: components["schemas"]["ModelParams"][] | null;/** @description litellm router object settings. See router.py __init__ for all, example router.num_retries=5, router.timeout=5, router.max_retries=5, router.retry_after=5 */router_settings?: components["schemas"]["UpdateRouterConfig"] | null;+ /**+ * Worker Registry+ * @description Global Control Plane: the independent proxy instances this instance's admin UI manages. Setting it makes this a control plane, which serves the UI and does not route LLM requests. Enterprise-only+ */+ worker_registry?: components["schemas"]["WorkerRegistryEntry"][] | null;};/** ConfigurableClientsideParamsCustomAuth */"ConfigurableClientsideParamsCustomAuth-Input": {