Skip to content

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]

Type _get_effective_ui_settings_class as Type[UISettings] for mypy

Yuneng Jiang85b6cae508bf
diff --git a/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py b/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py
index cc284da0243..8670face600 100644
--- a/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py
+++ b/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py
@@ -1,6 +1,6 @@
#### CRUD ENDPOINTS for UI Settings #####
import json
-from typing import Any, Dict, List, Optional, Set, Tuple, Union
+from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
from urllib.parse import urlparse
from fastapi import APIRouter, Body, Depends, File, HTTPException, UploadFile
@@ -204,7 +204,7 @@ _EXTRA_UI_SETTINGS_FIELDS: Dict[str, Tuple[Any, FieldInfo]] = {}
_ENTERPRISE_ONLY_UI_SETTINGS: Set[str] = {"enable_projects_ui"}
# Memoized effective class; invalidated on registration.
-_EFFECTIVE_UI_SETTINGS_CLASS: Optional[type] = None
+_EFFECTIVE_UI_SETTINGS_CLASS: Optional[Type[UISettings]] = None
def register_extra_ui_setting(name: str, annotation: Any, field: FieldInfo) -> None:
@@ -221,7 +221,7 @@ def register_extra_ui_setting(name: str, annotation: Any, field: FieldInfo) -> N
_EFFECTIVE_UI_SETTINGS_CLASS = None
-def _get_effective_ui_settings_class() -> type:
+def _get_effective_ui_settings_class() -> Type[UISettings]:
"""Return UISettings with any extension-registered fields merged in.
Memoized — pydantic ``create_model`` runs metaclass + schema work