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]

greptile issue

shivam44557261a3d1
diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md
index dde39bbc0b3..0362344d7be 100644
--- a/docs/my-website/docs/proxy/config_settings.md
+++ b/docs/my-website/docs/proxy/config_settings.md
@@ -775,7 +775,7 @@ router_settings:
| LITELLM_HOSTED_UI | URL of the hosted UI for LiteLLM
| LITELLM_UI_API_DOC_BASE_URL | Optional override for the API Reference base URL (used in sample code/docs) when the admin UI runs on a different host than the proxy. Defaults to `PROXY_BASE_URL` when unset.
| LITELLM_UI_PATH | Path to directory for Admin UI files. Used when running with read-only filesystem (e.g., Kubernetes). Default is `/var/lib/litellm/ui` in Docker.
-| LITELLM_UI_SESSION_DURATION | Duration for UI login session (username/password, SSO). Format: "30s", "30m", "24h", "7d". Applies to both default and EXPERIMENTAL_UI_LOGIN flows. Default is "24h"
+| LITELLM_UI_SESSION_DURATION | Duration for UI login session (username/password, SSO, invitation links). Format: "30s", "30m", "24h", "7d". Does not apply to EXPERIMENTAL_UI_LOGIN flow, which uses a fixed 10-minute expiry for security. Default is "24h"
| LITELM_ENVIRONMENT | Environment of LiteLLM Instance, used by logging services. Currently only used by DeepEval.
| LITELLM_KEY_ROTATION_ENABLED | Enable auto-key rotation for LiteLLM (boolean). Default is false.
| LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS | Interval in seconds for how often to run job that auto-rotates keys. Default is 86400 (24 hours).
diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.py
index 7c3345343ca..ef6b0ac462c 100644
--- a/litellm/proxy/auth/auth_checks.py
+++ b/litellm/proxy/auth/auth_checks.py
@@ -1884,7 +1884,7 @@ class ExperimentalUIJWTToken:
if user_info.user_role is None:
raise Exception("User role is required for experimental UI login")
- # Experimental UI flow uses shorter 10-min expiry for security (experimental = shorter-lived tokens)
+ # Experimental UI flow uses fixed 10-min expiry for security (does not use LITELLM_UI_SESSION_DURATION)
expiration_time = get_utc_datetime() + timedelta(minutes=10)
# Format the expiration time as ISO 8601 string
diff --git a/tests/test_litellm/proxy/auth/test_auth_checks.py b/tests/test_litellm/proxy/auth/test_auth_checks.py
index fb2f427e443..ad1ad299b27 100644
--- a/tests/test_litellm/proxy/auth/test_auth_checks.py
+++ b/tests/test_litellm/proxy/auth/test_auth_checks.py
@@ -108,27 +108,19 @@ def test_get_experimental_ui_login_jwt_auth_token_valid(valid_sso_user_defined_v
assert token_data["models"] == ["gpt-3.5-turbo"]
assert token_data["max_budget"] == litellm.max_ui_session_budget
- # Verify expiration time is set and valid (uses LITELLM_UI_SESSION_DURATION)
- from litellm.constants import LITELLM_UI_SESSION_DURATION
- from litellm.litellm_core_utils.duration_parser import duration_in_seconds
-
+ # Verify expiration time is set and valid (Experimental UI uses fixed 10-min expiry)
assert "expires" in token_data
expires = datetime.fromisoformat(token_data["expires"].replace("Z", "+00:00"))
- session_duration_seconds = duration_in_seconds(LITELLM_UI_SESSION_DURATION)
now = get_utc_datetime()
# Allow 2 second buffer for test execution timing
assert expires > now
- assert expires <= now + timedelta(seconds=session_duration_seconds + 2)
+ assert expires <= now + timedelta(minutes=10, seconds=2)
-def test_get_experimental_ui_login_jwt_auth_token_respects_session_duration(
- valid_sso_user_defined_values, monkeypatch
+def test_get_experimental_ui_login_jwt_auth_token_uses_10_min_expiry(
+ valid_sso_user_defined_values,
):
- """Test that LITELLM_UI_SESSION_DURATION controls token expiration"""
- from litellm.proxy.auth import auth_checks
-
- monkeypatch.setattr(auth_checks, "LITELLM_UI_SESSION_DURATION", "10m")
-
+ """Test that Experimental UI token uses fixed 10-minute expiry (does not use LITELLM_UI_SESSION_DURATION)."""
token = ExperimentalUIJWTToken.get_experimental_ui_login_jwt_auth_token(
valid_sso_user_defined_values
)