From dfb7424b4b3176903476816adb797cb3e0fbbcdf Mon Sep 17 00:00:00 2001 From: Noah Nistler <60981020+noahnistler@users.noreply.github.com> Date: Mon, 10 Aug 2026 15:45:08 -0500 Subject: [PATCH 01/14] fix(bedrock): sign rerank requests with the shared, header-filtered SigV4 helper BedrockRerankHandler._prepare_request duplicated ad-hoc SigV4 signing instead of using BaseAWSLLM.get_request_headers, the helper every other Bedrock handler (embeddings, converse, invoke, image) already uses. The duplicate skipped header filtering before signing, so any forwarded header (e.g. x-forwarded-for) got included in the signed set and could invalidate the signature if rewritten downstream between signing and delivery, the same class of bug fixed for the invoke path in #19111. --- litellm/llms/bedrock/rerank/handler.py | 29 +++++--------- .../test_bedrock_rerank_header_forwarding.py | 39 +++++++++++++++++++ 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/litellm/llms/bedrock/rerank/handler.py b/litellm/llms/bedrock/rerank/handler.py index 1cc72f265eb..79b70c47a9a 100644 --- a/litellm/llms/bedrock/rerank/handler.py +++ b/litellm/llms/bedrock/rerank/handler.py @@ -135,11 +135,6 @@ class BedrockRerankHandler(BaseAWSLLM): data: dict, optional_params: dict, ) -> BedrockPreparedRequest: - try: - from botocore.auth import SigV4Auth - from botocore.awsrequest import AWSRequest - except ImportError: - raise ImportError("Missing boto3 to call bedrock. Run 'pip install boto3'.") boto3_credentials_info: Final = self._get_boto_credentials_from_optional_params(optional_params, model) ### SET RUNTIME ENDPOINT ### @@ -150,24 +145,20 @@ class BedrockRerankHandler(BaseAWSLLM): ) proxy_endpoint_url = proxy_endpoint_url.replace("bedrock-runtime", "bedrock-agent-runtime") proxy_endpoint_url = f"{proxy_endpoint_url}/rerank" - sigv4: Final = SigV4Auth( - boto3_credentials_info.credentials, - "bedrock", - boto3_credentials_info.aws_region_name, - ) - # Make POST Request - body: Final = json.dumps(data).encode("utf-8") + body: Final = json.dumps(data).encode("utf-8") headers = {"Content-Type": "application/json"} if extra_headers is not None: headers = {"Content-Type": "application/json", **extra_headers} - request: Final = AWSRequest(method="POST", url=proxy_endpoint_url, data=body, headers=headers) - sigv4.add_auth(request) - if ( - extra_headers is not None and "Authorization" in extra_headers - ): # prevent sigv4 from overwriting the auth header - request.headers["Authorization"] = extra_headers["Authorization"] - prepped: Final = request.prepare() + + prepped: Final = self.get_request_headers( + credentials=boto3_credentials_info.credentials, + aws_region_name=boto3_credentials_info.aws_region_name, + extra_headers=extra_headers, + endpoint_url=proxy_endpoint_url, + data=body, + headers=headers, + ) return BedrockPreparedRequest( endpoint_url=proxy_endpoint_url, diff --git a/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py b/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py index 17443ca899e..748d46af895 100644 --- a/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py +++ b/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py @@ -17,6 +17,7 @@ sys.path.insert( ) # Adds the parent directory to the system path import litellm from litellm.llms.bedrock.base_aws_llm import Boto3CredentialsInfo +from litellm.llms.bedrock.rerank.handler import BedrockRerankHandler from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler # Mock response for Bedrock rerank @@ -408,3 +409,41 @@ def test_bedrock_rerank_extra_headers_and_headers_merge(): except Exception as e: pytest.fail(f"Failed to merge and forward headers: {str(e)}") + + +def test_bedrock_rerank_forwarded_headers_excluded_from_sigv4_signature(): + """ + A forwarded header like x-forwarded-for can be rewritten between LiteLLM + signing the request and AWS receiving it (e.g. by an intermediate load + balancer), which invalidates the signature if that header was part of + the signed set. It must still reach Bedrock, just unsigned. + """ + from botocore.credentials import Credentials + + handler = BedrockRerankHandler() + mock_credentials_info = Boto3CredentialsInfo( + credentials=Credentials("test-access-key", "test-secret-key", "test-token"), + aws_region_name="us-east-1", + aws_bedrock_runtime_endpoint=None, + ) + + with patch.object( + BedrockRerankHandler, + "_get_boto_credentials_from_optional_params", + return_value=mock_credentials_info, + ): + prepared_request = handler._prepare_request( + model="cohere.rerank-v3-5:0", + api_base=None, + extra_headers={"x-forwarded-for": "203.0.113.5"}, + data={"query": test_query, "documents": test_documents}, + optional_params={}, + ) + + headers = prepared_request["prepped"].headers + signed_headers = headers["Authorization"].split("SignedHeaders=")[1].split(",")[0].split(";") + + assert "x-forwarded-for" not in signed_headers, ( + f"x-forwarded-for must not be part of the SigV4 signature, got SignedHeaders={signed_headers}" + ) + assert headers["x-forwarded-for"] == "203.0.113.5", "forwarded header must still reach Bedrock, unsigned" From d80608eca6e9a1a98c3b0c2f7620c6d6496712e6 Mon Sep 17 00:00:00 2001 From: Noah Nistler <60981020+noahnistler@users.noreply.github.com> Date: Mon, 10 Aug 2026 15:58:12 -0500 Subject: [PATCH 02/14] test(bedrock): drop class-level monkeypatch in rerank signature test Pass static AWS credentials through optional_params so the real credential-resolution path runs locally instead of patching BedrockRerankHandler._get_boto_credentials_from_optional_params. --- .../test_bedrock_rerank_header_forwarding.py | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py b/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py index 748d46af895..ebe0df2a1c7 100644 --- a/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py +++ b/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py @@ -418,27 +418,19 @@ def test_bedrock_rerank_forwarded_headers_excluded_from_sigv4_signature(): balancer), which invalidates the signature if that header was part of the signed set. It must still reach Bedrock, just unsigned. """ - from botocore.credentials import Credentials - handler = BedrockRerankHandler() - mock_credentials_info = Boto3CredentialsInfo( - credentials=Credentials("test-access-key", "test-secret-key", "test-token"), - aws_region_name="us-east-1", - aws_bedrock_runtime_endpoint=None, - ) - with patch.object( - BedrockRerankHandler, - "_get_boto_credentials_from_optional_params", - return_value=mock_credentials_info, - ): - prepared_request = handler._prepare_request( - model="cohere.rerank-v3-5:0", - api_base=None, - extra_headers={"x-forwarded-for": "203.0.113.5"}, - data={"query": test_query, "documents": test_documents}, - optional_params={}, - ) + prepared_request = handler._prepare_request( + model="cohere.rerank-v3-5:0", + api_base=None, + extra_headers={"x-forwarded-for": "203.0.113.5"}, + data={"query": test_query, "documents": test_documents}, + optional_params={ + "aws_access_key_id": "test-access-key", + "aws_secret_access_key": "test-secret-key", + "aws_region_name": "us-east-1", + }, + ) headers = prepared_request["prepped"].headers signed_headers = headers["Authorization"].split("SignedHeaders=")[1].split(",")[0].split(";") From 729a95232204599e550f46c3de8aec1af9455673 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Fri, 21 Aug 2026 17:17:24 -0700 Subject: [PATCH 03/14] fix(bedrock): keep rerank on SigV4 when a Bedrock API key is set Routing rerank through get_request_headers also picked up its AWS_BEARER_TOKEN_BEDROCK branch. Bedrock API keys are only valid for Bedrock and Bedrock Runtime actions, not for Agents for Amazon Bedrock Runtime ones, and rerank is served by bedrock-agent-runtime, so AWS rejects a bearer-signed rerank call. Opt the rerank handler out of the bearer path so it keeps signing with SigV4. --- litellm/llms/bedrock/base_aws_llm.py | 7 +++-- litellm/llms/bedrock/rerank/handler.py | 1 + .../test_bedrock_rerank_header_forwarding.py | 30 +++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/litellm/llms/bedrock/base_aws_llm.py b/litellm/llms/bedrock/base_aws_llm.py index db6f2c0d491..4332848e545 100644 --- a/litellm/llms/bedrock/base_aws_llm.py +++ b/litellm/llms/bedrock/base_aws_llm.py @@ -1434,9 +1434,12 @@ class BaseAWSLLM: data: str | bytes, headers: dict, api_key: str | None = None, + supports_bearer_token: bool = True, ) -> AWSPreparedRequest: - if api_key is not None: - aws_bearer_token: str | None = api_key + if not supports_bearer_token: + aws_bearer_token: str | None = None + elif api_key is not None: + aws_bearer_token = api_key else: aws_bearer_token = get_secret_str("AWS_BEARER_TOKEN_BEDROCK") diff --git a/litellm/llms/bedrock/rerank/handler.py b/litellm/llms/bedrock/rerank/handler.py index 79b70c47a9a..cb0473887ea 100644 --- a/litellm/llms/bedrock/rerank/handler.py +++ b/litellm/llms/bedrock/rerank/handler.py @@ -158,6 +158,7 @@ class BedrockRerankHandler(BaseAWSLLM): endpoint_url=proxy_endpoint_url, data=body, headers=headers, + supports_bearer_token=False, ) return BedrockPreparedRequest( diff --git a/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py b/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py index ebe0df2a1c7..dd14b38f07a 100644 --- a/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py +++ b/tests/test_litellm/llms/bedrock/rerank/test_bedrock_rerank_header_forwarding.py @@ -439,3 +439,33 @@ def test_bedrock_rerank_forwarded_headers_excluded_from_sigv4_signature(): f"x-forwarded-for must not be part of the SigV4 signature, got SignedHeaders={signed_headers}" ) assert headers["x-forwarded-for"] == "203.0.113.5", "forwarded header must still reach Bedrock, unsigned" + + +def test_bedrock_rerank_signs_with_sigv4_even_when_bedrock_api_key_is_set(monkeypatch): + """ + Bedrock API keys are only valid for Bedrock and Bedrock Runtime actions, not for + Agents for Amazon Bedrock Runtime ones. Rerank is served by bedrock-agent-runtime, + so it has to keep signing with SigV4 even when AWS_BEARER_TOKEN_BEDROCK is set. + """ + monkeypatch.setenv("AWS_BEARER_TOKEN_BEDROCK", "test-bedrock-api-key") + + handler = BedrockRerankHandler() + + prepared_request = handler._prepare_request( + model="cohere.rerank-v3-5:0", + api_base=None, + extra_headers=None, + data={"query": test_query, "documents": test_documents}, + optional_params={ + "aws_access_key_id": "test-access-key", + "aws_secret_access_key": "test-secret-key", + "aws_region_name": "us-east-1", + }, + ) + + assert prepared_request["endpoint_url"].startswith("https://bedrock-agent-runtime.") + + authorization = prepared_request["prepped"].headers["Authorization"] + assert authorization.startswith("AWS4-HMAC-SHA256"), ( + f"rerank must sign with SigV4, got Authorization={authorization[:30]}" + ) From 41192ef08541d30e91b1824b69ee773d1021b013 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Wed, 26 Aug 2026 12:16:24 -0700 Subject: [PATCH 04/14] feat(ui): toggle internal health check visibility in request logs --- .../spend_management_endpoints.py | 15 ++ .../test_spend_management_endpoints.py | 142 ++++++++++++++++++ .../src/components/networking.test.ts | 58 +++++++ .../src/components/networking.tsx | 3 + .../components/view_logs/LogsTableToolbar.tsx | 13 ++ .../view_logs/RequestLogsPanel.test.tsx | 29 ++++ .../components/view_logs/RequestLogsPanel.tsx | 20 +++ .../view_logs/log_filter_logic.test.tsx | 18 +++ .../components/view_logs/log_filter_logic.tsx | 4 + ui/litellm-dashboard/src/lib/http/schema.d.ts | 4 + 10 files changed, 306 insertions(+) diff --git a/litellm/proxy/spend_tracking/spend_management_endpoints.py b/litellm/proxy/spend_tracking/spend_management_endpoints.py index 06395a3c3cc..26da42a2f5c 100644 --- a/litellm/proxy/spend_tracking/spend_management_endpoints.py +++ b/litellm/proxy/spend_tracking/spend_management_endpoints.py @@ -23,6 +23,7 @@ from typing_extensions import ReadOnly import litellm from litellm._logging import verbose_proxy_logger +from litellm.constants import LITTELM_INTERNAL_HEALTH_SERVICE_ACCOUNT_NAME from litellm.proxy._types import * from litellm.proxy._types import ProviderBudgetResponse, ProviderBudgetResponseObject from litellm.proxy.auth.user_api_key_auth import user_api_key_auth @@ -54,6 +55,11 @@ router: Final = APIRouter() SPEND_LOGS_PAGINATION_COUNT_CAP: Final = 10000 +_INTERNAL_HEALTH_CHECK_API_KEYS: Final = ( + LITTELM_INTERNAL_HEALTH_SERVICE_ACCOUNT_NAME, + hash_token(token=LITTELM_INTERNAL_HEALTH_SERVICE_ACCOUNT_NAME), +) + _RowT = TypeVar("_RowT") @@ -2259,6 +2265,10 @@ async def ui_view_spend_logs( default="desc", description="Sort order: asc or desc", ), + exclude_internal_health_checks: bool = fastapi.Query( + default=False, + description="Exclude LiteLLM internal health check requests from results", + ), ): """ View spend logs with pagination support. @@ -2551,6 +2561,11 @@ async def ui_view_spend_logs( sql_params.append(status_filter) p += 1 + if exclude_internal_health_checks: + sql_conditions.append(f"api_key NOT IN (${p}, ${p + 1})") + sql_params.extend(_INTERNAL_HEALTH_CHECK_API_KEYS) + p += 2 # rebind-ok: advances the file's shared $N placeholder counter + # Spend range if min_spend is not None: sql_conditions.append(f"spend >= ${p}") diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py b/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py index 8c15ead8983..752894087dc 100644 --- a/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py +++ b/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py @@ -1,6 +1,7 @@ import asyncio import collections import datetime +import hashlib import json import re from datetime import timezone @@ -96,6 +97,7 @@ def _reconstruct_ui_where_from_sql(sql_query, params): msg = re.search(r"error_message' LIKE \$(\d+)", cond) sess = re.fullmatch(r"session_id LIKE \$(\d+)", cond) status = re.fullmatch(r"status = \$(\d+)", cond) + api_key_not_in = re.fullmatch(r"api_key NOT IN \(\$(\d+), \$(\d+)\)", cond) if gte: date_bounds["gte"] = _iso(params[int(gte.group(1)) - 1]) elif lte: @@ -108,6 +110,11 @@ def _reconstruct_ui_where_from_sql(sql_query, params): where["session_id"] = {"contains": str(params[int(sess.group(1)) - 1]).strip("%")} elif status: where["status"] = {"equals": params[int(status.group(1)) - 1]} + elif api_key_not_in: + where["api_key_not_in"] = [ + params[int(api_key_not_in.group(1)) - 1], + params[int(api_key_not_in.group(2)) - 1], + ] elif alias: metadata_conds.append( { @@ -196,6 +203,7 @@ def make_ui_spend_logs_mock_prisma(mock_spend_logs, filter_fn, team_lookup_fn=No return MockPrismaClient() +from litellm.constants import LITTELM_INTERNAL_HEALTH_SERVICE_ACCOUNT_NAME from litellm.proxy._types import ( LitellmUserRoles, Member, @@ -1256,6 +1264,140 @@ async def test_ui_view_spend_logs_with_team_id(client, monkeypatch): app.dependency_overrides.pop(ps.user_api_key_auth, None) +_HEALTH_CHECK_HASHED_API_KEY = hashlib.sha256(LITTELM_INTERNAL_HEALTH_SERVICE_ACCOUNT_NAME.encode()).hexdigest() + + +def _spend_logs_with_health_check_rows(): + now = datetime.datetime.now(timezone.utc).isoformat() + return [ + { + "id": "log1", + "request_id": "req1", + "api_key": "sk-test-key", + "user": "test_user_1", + "team_id": None, + "spend": 0.05, + "startTime": now, + "model": "gpt-4", + }, + { + "id": "log2", + "request_id": "req2", + "api_key": _HEALTH_CHECK_HASHED_API_KEY, + "user": None, + "team_id": LITTELM_INTERNAL_HEALTH_SERVICE_ACCOUNT_NAME, + "spend": 0.0, + "startTime": now, + "model": "gpt-4", + }, + { + "id": "log3", + "request_id": "req3", + "api_key": LITTELM_INTERNAL_HEALTH_SERVICE_ACCOUNT_NAME, + "user": None, + "team_id": LITTELM_INTERNAL_HEALTH_SERVICE_ACCOUNT_NAME, + "spend": 0.0, + "startTime": now, + "model": "gpt-4", + }, + ] + + +@pytest.mark.asyncio +async def test_ui_view_spend_logs_exclude_internal_health_checks(client, monkeypatch): + mock_spend_logs = _spend_logs_with_health_check_rows() + + def filter_health_checks(where): + excluded = where.get("api_key_not_in") + if excluded is None: + return mock_spend_logs + return [log for log in mock_spend_logs if log["api_key"] not in excluded] + + observed_queries = [] + + def observe_query(sql_query, params): + if 'FROM "LiteLLM_SpendLogs"' in sql_query: + observed_queries.append((sql_query, params)) + + monkeypatch.setattr( + "litellm.proxy.proxy_server.prisma_client", + make_ui_spend_logs_mock_prisma(mock_spend_logs, filter_health_checks, query_observer=observe_query), + ) + app.dependency_overrides[ps.user_api_key_auth] = lambda: UserAPIKeyAuth( + user_role=LitellmUserRoles.PROXY_ADMIN, user_id="admin_user" + ) + + try: + start_date, end_date = _default_date_range() + response = client.get( + "/spend/logs/ui", + params={ + "exclude_internal_health_checks": "true", + "start_date": start_date, + "end_date": end_date, + }, + headers={"Authorization": "Bearer sk-test"}, + ) + + assert response.status_code == 200 + data = response.json() + assert data["total"] == 1 + assert [row["request_id"] for row in data["data"]] == ["req1"] + + page_sql, page_params = next((sql, params) for sql, params in observed_queries if "ORDER BY" in sql) + not_in = re.search(r"api_key NOT IN \(\$(\d+), \$(\d+)\)", page_sql) + assert not_in is not None + assert LITTELM_INTERNAL_HEALTH_SERVICE_ACCOUNT_NAME not in page_sql + assert _HEALTH_CHECK_HASHED_API_KEY not in page_sql + assert { + page_params[int(not_in.group(1)) - 1], + page_params[int(not_in.group(2)) - 1], + } == {LITTELM_INTERNAL_HEALTH_SERVICE_ACCOUNT_NAME, _HEALTH_CHECK_HASHED_API_KEY} + finally: + app.dependency_overrides.pop(ps.user_api_key_auth, None) + + +@pytest.mark.asyncio +async def test_ui_view_spend_logs_includes_internal_health_checks_by_default(client, monkeypatch): + mock_spend_logs = _spend_logs_with_health_check_rows() + + def filter_health_checks(where): + excluded = where.get("api_key_not_in") + if excluded is None: + return mock_spend_logs + return [log for log in mock_spend_logs if log["api_key"] not in excluded] + + observed_queries = [] + + def observe_query(sql_query, params): + if 'FROM "LiteLLM_SpendLogs"' in sql_query: + observed_queries.append((sql_query, params)) + + monkeypatch.setattr( + "litellm.proxy.proxy_server.prisma_client", + make_ui_spend_logs_mock_prisma(mock_spend_logs, filter_health_checks, query_observer=observe_query), + ) + app.dependency_overrides[ps.user_api_key_auth] = lambda: UserAPIKeyAuth( + user_role=LitellmUserRoles.PROXY_ADMIN, user_id="admin_user" + ) + + try: + start_date, end_date = _default_date_range() + response = client.get( + "/spend/logs/ui", + params={"start_date": start_date, "end_date": end_date}, + headers={"Authorization": "Bearer sk-test"}, + ) + + assert response.status_code == 200 + data = response.json() + assert data["total"] == 3 + assert [row["request_id"] for row in data["data"]] == ["req1", "req2", "req3"] + assert all("NOT IN" not in sql for sql, _ in observed_queries) + finally: + app.dependency_overrides.pop(ps.user_api_key_auth, None) + + @pytest.mark.asyncio async def test_ui_view_spend_logs_internal_user_scoped_without_user_id( client, monkeypatch diff --git a/ui/litellm-dashboard/src/components/networking.test.ts b/ui/litellm-dashboard/src/components/networking.test.ts index f12a52a0bcf..cd22935a66f 100644 --- a/ui/litellm-dashboard/src/components/networking.test.ts +++ b/ui/litellm-dashboard/src/components/networking.test.ts @@ -459,6 +459,64 @@ describe("teamInfoCall", () => { }); }); +describe("uiSpendLogsCall exclude_internal_health_checks serialization", () => { + const originalFetch = global.fetch; + + beforeEach(() => { + vi.clearAllMocks(); + }); + + afterEach(() => { + global.fetch = originalFetch; + }); + + const mockOkFetch = () => { + const mockFetch = vi.fn().mockResolvedValue({ + ok: true, + json: vi.fn().mockResolvedValue({ data: [], total: 0, page: 1, page_size: 50, total_pages: 0 }), + } as any); + global.fetch = mockFetch as any; + return mockFetch; + }; + + const callWith = (params: Parameters[0]["params"]) => + Networking.uiSpendLogsCall({ + accessToken: "token", + start_date: "2026-01-01 00:00:00", + end_date: "2026-01-02 00:00:00", + params, + }); + + const lastUrl = (mockFetch: ReturnType) => { + const [url] = mockFetch.mock.calls.at(-1) ?? []; + return new URL(url as string, "http://example.com"); + }; + + it("appends exclude_internal_health_checks=true when the toggle is on", async () => { + const mockFetch = mockOkFetch(); + + await callWith({ exclude_internal_health_checks: true }); + + expect(lastUrl(mockFetch).searchParams.get("exclude_internal_health_checks")).toBe("true"); + }); + + it("omits exclude_internal_health_checks when the toggle is off", async () => { + const mockFetch = mockOkFetch(); + + await callWith({ exclude_internal_health_checks: false }); + + expect(lastUrl(mockFetch).searchParams.has("exclude_internal_health_checks")).toBe(false); + }); + + it("omits exclude_internal_health_checks when the param is absent", async () => { + const mockFetch = mockOkFetch(); + + await callWith({}); + + expect(lastUrl(mockFetch).searchParams.has("exclude_internal_health_checks")).toBe(false); + }); +}); + describe("sessionSpendLogsCall", () => { const originalFetch = global.fetch; diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx index 5b6d70b4771..c7868a5f039 100644 --- a/ui/litellm-dashboard/src/components/networking.tsx +++ b/ui/litellm-dashboard/src/components/networking.tsx @@ -2013,6 +2013,7 @@ interface UiSpendLogsParams { sort_order?: "asc" | "desc"; min_spend?: number; max_spend?: number; + exclude_internal_health_checks?: boolean; } interface UiSpendLogsCallOptions { @@ -2047,6 +2048,8 @@ export const uiSpendLogsCall = async ({ if (value == null) continue; if (key === "min_spend" || key === "max_spend") { queryParams.append(key, value.toString()); + } else if (typeof value === "boolean") { + if (value) queryParams.append(key, "true"); } else if (typeof value === "string" && value !== "") { queryParams.append(key, String(value)); } diff --git a/ui/litellm-dashboard/src/components/view_logs/LogsTableToolbar.tsx b/ui/litellm-dashboard/src/components/view_logs/LogsTableToolbar.tsx index 7cd339f1d48..cb7836d603f 100644 --- a/ui/litellm-dashboard/src/components/view_logs/LogsTableToolbar.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/LogsTableToolbar.tsx @@ -23,6 +23,8 @@ interface LogsTableToolbarProps { onSelectedTimeIntervalChange: (value: { value: number; unit: string }) => void; isLiveTail: boolean; onIsLiveTailChange: (value: boolean) => void; + excludeInternalHealthChecks: boolean; + onExcludeInternalHealthChecksChange: (value: boolean) => void; onResetToFirstPage: () => void; onResetFilters: () => void; } @@ -38,6 +40,8 @@ export function LogsTableToolbar({ onSelectedTimeIntervalChange, isLiveTail, onIsLiveTailChange, + excludeInternalHealthChecks, + onExcludeInternalHealthChecksChange, onResetToFirstPage, onResetFilters, }: LogsTableToolbarProps) { @@ -125,6 +129,15 @@ export function LogsTableToolbar({ +
+ Hide Health Checks + +
+ diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx index b68e12b9c3d..593bebdbdae 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx @@ -434,6 +434,35 @@ describe("RequestLogsPanel", () => { }); }); + describe("hide health checks", () => { + const toggle = () => screen.getByRole("switch", { name: "Hide Health Checks" }); + + it("defaults to showing health checks and refetches without them from page 1 when toggled on", async () => { + const user = userEvent.setup(); + renderPanel(); + + await waitFor(() => expect(uiSpendLogsCall).toHaveBeenCalled()); + expect(lastCall()?.params?.exclude_internal_health_checks).toBe(false); + expect(toggle()).not.toBeChecked(); + + await user.click(toggle()); + + await waitFor(() => expect(lastCall()?.params?.exclude_internal_health_checks).toBe(true)); + expect(lastCall()?.page).toBe(1); + expect(toggle()).toBeChecked(); + expect(sessionStorage.getItem("excludeInternalHealthChecks")).toBe("true"); + }); + + it("restores the persisted toggle from sessionStorage", async () => { + sessionStorage.setItem("excludeInternalHealthChecks", "true"); + renderPanel(); + + await waitFor(() => expect(uiSpendLogsCall).toHaveBeenCalled()); + expect(lastCall()?.params?.exclude_internal_health_checks).toBe(true); + expect(toggle()).toBeChecked(); + }); + }); + describe("live tail", () => { it("shows the auto-refresh banner on the first page and hides it once stopped", async () => { const user = userEvent.setup(); diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx index b6f61cb3c6b..4e424904d40 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx @@ -72,6 +72,15 @@ export default function RequestLogsPanel({ accessToken, token, userRole, userID, sessionStorage.setItem("isLiveTail", JSON.stringify(isLiveTail)); }, [isLiveTail]); + const [excludeInternalHealthChecks, setExcludeInternalHealthChecks] = useState(() => { + const storedValue = sessionStorage.getItem("excludeInternalHealthChecks"); + return storedValue !== null ? JSON.parse(storedValue) : false; + }); + + useEffect(() => { + sessionStorage.setItem("excludeInternalHealthChecks", JSON.stringify(excludeInternalHealthChecks)); + }, [excludeInternalHealthChecks]); + const { logsQuery, filteredLogs, allTeams } = useLogFilterLogic({ accessToken, token, @@ -80,6 +89,7 @@ export default function RequestLogsPanel({ accessToken, token, userRole, userID, columnFilters, activeTab: isActive ? "request logs" : "inactive", isLiveTail, + excludeInternalHealthChecks, startTime, endTime, pagination, @@ -219,6 +229,14 @@ export default function RequestLogsPanel({ accessToken, token, userRole, userID, setPagination((previous) => ({ ...previous, pageIndex: 0 })); }, []); + const handleExcludeInternalHealthChecksChange = useCallback( + (value: boolean) => { + setExcludeInternalHealthChecks(value); + resetToFirstPage(); + }, + [resetToFirstPage], + ); + const handleResetFilters = useCallback(() => { setColumnFilters([]); setStartTime(moment().subtract(24, "hours").format("YYYY-MM-DDTHH:mm")); @@ -313,6 +331,8 @@ export default function RequestLogsPanel({ accessToken, token, userRole, userID, onSelectedTimeIntervalChange={setSelectedTimeInterval} isLiveTail={isLiveTail} onIsLiveTailChange={setIsLiveTail} + excludeInternalHealthChecks={excludeInternalHealthChecks} + onExcludeInternalHealthChecksChange={handleExcludeInternalHealthChecksChange} onResetToFirstPage={resetToFirstPage} onResetFilters={handleResetFilters} /> diff --git a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.test.tsx b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.test.tsx index 26c5bda1593..b61461dc4d7 100644 --- a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.test.tsx @@ -47,6 +47,7 @@ const defaultProps = { columnFilters: [] as ColumnFiltersState, activeTab: "request logs", isLiveTail: false, + excludeInternalHealthChecks: false, startTime: "2025-01-01T00:00:00", endTime: "2025-01-01T23:59:59", pagination: FIRST_PAGE, @@ -152,6 +153,7 @@ describe("useLogFilterLogic", () => { ["pagination", { pagination: { pageIndex: 1, pageSize: 50 } }], ["startTime", { startTime: "2025-02-02T00:00:00" }], ["columnFilters", { columnFilters: [{ id: LOG_FILTER_IDS.TEAM_ID, value: "team-2" }] }], + ["excludeInternalHealthChecks", { excludeInternalHealthChecks: true }], ])("refetches when %s changes", async (_label, nextProps) => { const { rerender } = renderHook((props: HookOverrides) => useLogFilterLogic({ ...defaultProps, ...props }), { wrapper, @@ -164,6 +166,22 @@ describe("useLogFilterLogic", () => { }); }); + describe("hide health checks toggle", () => { + it("passes exclude_internal_health_checks when the toggle is on", async () => { + renderFilterHook({ excludeInternalHealthChecks: true }); + + await waitFor(() => expect(uiSpendLogsCall).toHaveBeenCalled()); + expect(lastCallParams()?.params).toMatchObject({ exclude_internal_health_checks: true }); + }); + + it("passes exclude_internal_health_checks as false when the toggle is off", async () => { + renderFilterHook(); + + await waitFor(() => expect(uiSpendLogsCall).toHaveBeenCalled()); + expect(lastCallParams()?.params).toMatchObject({ exclude_internal_health_checks: false }); + }); + }); + describe("query enablement", () => { it("does not query when the request logs tab is inactive", async () => { renderFilterHook({ activeTab: "audit logs" }); diff --git a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx index 474f51e93b3..9b6666dc9ee 100644 --- a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx @@ -101,6 +101,7 @@ export function useLogFilterLogic({ columnFilters, activeTab, isLiveTail, + excludeInternalHealthChecks, startTime, endTime, pagination, @@ -114,6 +115,7 @@ export function useLogFilterLogic({ columnFilters: ColumnFiltersState; activeTab: string; isLiveTail: boolean; + excludeInternalHealthChecks: boolean; startTime: string; endTime: string; pagination: PaginationState; @@ -137,6 +139,7 @@ export function useLogFilterLogic({ columnFilters, sortBy, sortOrder, + excludeInternalHealthChecks, ], queryFn: async () => { if (!accessToken || !token || !userRole || !userID) { @@ -174,6 +177,7 @@ export function useLogFilterLogic({ error_message: getFilterValue(columnFilters, LOG_FILTER_IDS.ERROR_MESSAGE), sort_by: sortBy, sort_order: sortOrder, + exclude_internal_health_checks: excludeInternalHealthChecks, }, }); }, diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.ts index 3d657ea53a7..04873dd5dc9 100644 --- a/ui/litellm-dashboard/src/lib/http/schema.d.ts +++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts @@ -53256,6 +53256,8 @@ export interface operations { sort_by?: string; /** @description Sort order: asc or desc */ sort_order?: string | null; + /** @description Exclude LiteLLM internal health check requests from results */ + exclude_internal_health_checks?: boolean; }; header?: never; path?: never; @@ -53364,6 +53366,8 @@ export interface operations { sort_by?: string; /** @description Sort order: asc or desc */ sort_order?: string | null; + /** @description Exclude LiteLLM internal health check requests from results */ + exclude_internal_health_checks?: boolean; }; header?: never; path?: never; From 19a1d5c4c6e88aae8577c7286df5e43ff0bf8373 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Wed, 26 Aug 2026 12:52:10 -0700 Subject: [PATCH 05/14] fix(ui): tolerate malformed persisted hide-health-checks value --- .../src/components/view_logs/RequestLogsPanel.test.tsx | 9 +++++++++ .../src/components/view_logs/RequestLogsPanel.tsx | 7 +++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx index 593bebdbdae..22e3f635b50 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx @@ -461,6 +461,15 @@ describe("RequestLogsPanel", () => { expect(lastCall()?.params?.exclude_internal_health_checks).toBe(true); expect(toggle()).toBeChecked(); }); + + it("falls back to showing health checks when the persisted value is malformed", async () => { + sessionStorage.setItem("excludeInternalHealthChecks", "{not json"); + renderPanel(); + + await waitFor(() => expect(uiSpendLogsCall).toHaveBeenCalled()); + expect(lastCall()?.params?.exclude_internal_health_checks).toBe(false); + expect(toggle()).not.toBeChecked(); + }); }); describe("live tail", () => { diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx index 4e424904d40..52ea78abf5e 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx @@ -72,10 +72,9 @@ export default function RequestLogsPanel({ accessToken, token, userRole, userID, sessionStorage.setItem("isLiveTail", JSON.stringify(isLiveTail)); }, [isLiveTail]); - const [excludeInternalHealthChecks, setExcludeInternalHealthChecks] = useState(() => { - const storedValue = sessionStorage.getItem("excludeInternalHealthChecks"); - return storedValue !== null ? JSON.parse(storedValue) : false; - }); + const [excludeInternalHealthChecks, setExcludeInternalHealthChecks] = useState( + () => sessionStorage.getItem("excludeInternalHealthChecks") === "true", + ); useEffect(() => { sessionStorage.setItem("excludeInternalHealthChecks", JSON.stringify(excludeInternalHealthChecks)); From cc400502fa84f04db5a7cc2301b4764caa68e9e7 Mon Sep 17 00:00:00 2001 From: Daniel Meismer Date: Wed, 26 Aug 2026 16:09:21 -0400 Subject: [PATCH 06/14] fix(mcp): canonicalize bearer scheme on bridge egress Co-Authored-By: Codex --- .../bridge_credentials.py | 3 ++- .../test_bridge_credentials.py | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/_experimental/mcp_server/outbound_credentials/bridge_credentials.py b/litellm/proxy/_experimental/mcp_server/outbound_credentials/bridge_credentials.py index 69feaaff195..f8a95daecac 100644 --- a/litellm/proxy/_experimental/mcp_server/outbound_credentials/bridge_credentials.py +++ b/litellm/proxy/_experimental/mcp_server/outbound_credentials/bridge_credentials.py @@ -239,5 +239,6 @@ def resolve_bridge_envelope( if opened.identity.server_id != expected_server_id: return BridgeEnvelopeInvalid() grant: Final = opened.grant - upstream_authorization: Final = f"{grant.token_type} {grant.access_token.get_secret_value()}" + authorization_scheme: Final = "Bearer" if grant.token_type.lower() == "bearer" else grant.token_type + upstream_authorization: Final = f"{authorization_scheme} {grant.access_token.get_secret_value()}" return BridgeEnvelopeAdmitted(identity=opened.identity, upstream_authorization=SecretStr(upstream_authorization)) diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_bridge_credentials.py b/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_bridge_credentials.py index 753a3d6a942..f8fb22469f1 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_bridge_credentials.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_bridge_credentials.py @@ -10,6 +10,7 @@ through the consumer; and no path leaks the upstream token in a repr. from datetime import datetime, timedelta, timezone +import pytest from pydantic import SecretStr from litellm.proxy._experimental.mcp_server.outbound_credentials.bridge_credentials import ( @@ -188,6 +189,31 @@ def test_resolve_strips_optional_bearer_scheme_before_detection(): assert prefixed.upstream_authorization.get_secret_value() == bare.upstream_authorization.get_secret_value() +@pytest.mark.parametrize("token_type", ("bearer", "BEARER", "beArEr")) +def test_resolve_canonicalizes_case_insensitive_bearer_token_type(token_type: str): + keys = envelope_keys_from_master_key(_MASTER_KEY) + grant = UpstreamTokenGrant(access_token=SecretStr(_ACCESS_TOKEN), token_type=token_type, expires_in=600) + sealed = mint_envelope(_IDENTITY, grant, keys, _NOW) + assert isinstance(sealed, SealedEnvelope) + + result = resolve_bridge_envelope(sealed.token.get_secret_value(), keys, _NOW, _SERVER_ID) + + assert isinstance(result, BridgeEnvelopeAdmitted) + assert result.upstream_authorization.get_secret_value() == f"Bearer {_ACCESS_TOKEN}" + + +def test_resolve_preserves_non_bearer_token_type(): + keys = envelope_keys_from_master_key(_MASTER_KEY) + grant = UpstreamTokenGrant(access_token=SecretStr(_ACCESS_TOKEN), token_type="DPoP", expires_in=600) + sealed = mint_envelope(_IDENTITY, grant, keys, _NOW) + assert isinstance(sealed, SealedEnvelope) + + result = resolve_bridge_envelope(sealed.token.get_secret_value(), keys, _NOW, _SERVER_ID) + + assert isinstance(result, BridgeEnvelopeAdmitted) + assert result.upstream_authorization.get_secret_value() == f"DPoP {_ACCESS_TOKEN}" + + def test_resolve_expired_envelope_is_invalid_not_admitted(): keys = envelope_keys_from_master_key(_MASTER_KEY) token = _sealed_token(keys, now=_NOW) From afe5a240e5e99a7b544b2aca036adf6fafdede77 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Wed, 26 Aug 2026 14:32:04 -0700 Subject: [PATCH 07/14] fix(proxy): regenerate lazy OpenAPI snapshot and guard it in CI The committed snapshot behind /openapi.json for unloaded lazy features had drifted on 30 of 31 fragments and never had one for a2a_registration or gemini_agents, so those routes showed as placeholder GET stubs or old docstrings until traffic loaded them. Regenerate the snapshot and schema.d.ts, make the check-ui-api-types job and make check regenerate the snapshot and fail on drift, and make the generator refuse to write a snapshot when any feature fails to import so a broken import cannot silently drop fragments. --- .github/workflows/check-ui-api-types.yml | 18 + litellm/proxy/_lazy_openapi_snapshot.json | 7790 +++++++++++++++-- litellm/proxy/_lazy_openapi_snapshot.py | 62 +- scripts/pre_commit_lint.sh | 11 +- .../proxy/test_lazy_openapi_snapshot.py | 67 +- ui/litellm-dashboard/src/lib/http/schema.d.ts | 2942 ++++++- 6 files changed, 9889 insertions(+), 1001 deletions(-) diff --git a/.github/workflows/check-ui-api-types.yml b/.github/workflows/check-ui-api-types.yml index 285676a0ddd..312a80103f8 100644 --- a/.github/workflows/check-ui-api-types.yml +++ b/.github/workflows/check-ui-api-types.yml @@ -83,6 +83,24 @@ jobs: if: steps.changes.outputs.relevant == 'true' run: uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma + - name: Regenerate the lazy OpenAPI snapshot + if: steps.changes.outputs.relevant == 'true' + run: uv run --no-sync python -m litellm.proxy._lazy_openapi_snapshot + + - name: Fail if the lazy OpenAPI snapshot is stale + if: steps.changes.outputs.relevant == 'true' + run: | + if ! git diff --exit-code -- litellm/proxy/_lazy_openapi_snapshot.json; then + echo "::error file=litellm/proxy/_lazy_openapi_snapshot.json::The lazy OpenAPI snapshot is out of sync with the lazily loaded routes." + echo "" + echo "A lazily loaded route or model changed without regenerating the snapshot that /openapi.json serves for unloaded features." + echo "To fix, run from the repo root:" + echo " uv run python -m litellm.proxy._lazy_openapi_snapshot" + echo "then run npm run gen:api from ui/litellm-dashboard and commit both files." + exit 1 + fi + echo "_lazy_openapi_snapshot.json is in sync with the lazily loaded routes." + - name: Set up Node.js if: steps.changes.outputs.relevant == 'true' uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 diff --git a/litellm/proxy/_lazy_openapi_snapshot.json b/litellm/proxy/_lazy_openapi_snapshot.json index 026a02d6b1d..20c4ad4bd25 100644 --- a/litellm/proxy/_lazy_openapi_snapshot.json +++ b/litellm/proxy/_lazy_openapi_snapshot.json @@ -17,6 +17,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -283,6 +290,174 @@ } } }, + "a2a_registration": { + "components": { + "schemas": { + "DiscoverAgentRequest": { + "properties": { + "discovery_mode": { + "$ref": "#/components/schemas/DiscoveryMode", + "default": "well_known_fallback", + "description": "How to locate the upstream card. ``well_known_fallback`` for pure A2A agents (try standard paths); ``langgraph_platform`` for LangGraph Platform deployments where the card is shared across assistants and disambiguated by a query parameter." + }, + "params": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "description": "Mode-specific parameters. ``langgraph_platform`` requires ``{'assistant_id': }``. ``well_known_fallback`` ignores this.", + "title": "Params" + }, + "url": { + "description": "Base URL of the upstream agent. Behavior depends on ``discovery_mode``: ``well_known_fallback`` (default) tries /.well-known/agent-card.json, /.well-known/agent.json, /agent.json under this URL in order; ``langgraph_platform`` hits ``/.well-known/agent-card.json?assistant_id=`` instead.", + "title": "Url", + "type": "string" + } + }, + "required": [ + "url" + ], + "title": "DiscoverAgentRequest", + "type": "object" + }, + "DiscoverAgentResponse": { + "properties": { + "agent_card": { + "additionalProperties": true, + "title": "Agent Card", + "type": "object" + }, + "url": { + "title": "Url", + "type": "string" + } + }, + "required": [ + "url", + "agent_card" + ], + "title": "DiscoverAgentResponse", + "type": "object" + }, + "DiscoveryMode": { + "description": "How to locate the upstream agent card.\n\nString-valued so it serializes cleanly over JSON / Pydantic.", + "enum": [ + "well_known_fallback", + "langgraph_platform" + ], + "title": "DiscoveryMode", + "type": "string" + }, + "HTTPValidationError": { + "properties": { + "detail": { + "items": { + "$ref": "#/components/schemas/ValidationError" + }, + "title": "Detail", + "type": "array" + } + }, + "title": "HTTPValidationError", + "type": "object" + }, + "ValidationError": { + "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "title": "Location", + "type": "array" + }, + "msg": { + "title": "Message", + "type": "string" + }, + "type": { + "title": "Error Type", + "type": "string" + } + }, + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError", + "type": "object" + } + } + }, + "paths": { + "/v1/a2a/discover": { + "post": { + "description": "Fetch the upstream agent's well-known card so the UI can show the admin\nwhich skills/capabilities the agent exposes.\n\nOnly proxy admins can call this \u2014 the UI uses it during agent registration,\nand we don't want arbitrary keys probing internal URLs.\n\nExample:\n```bash\ncurl -X POST \"http://localhost:4000/v1/a2a/discover\" \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://upstream-agent.example.com\"}'\n```", + "operationId": "discover_agent_card_v1_a2a_discover_post", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DiscoverAgentRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DiscoverAgentResponse" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Discover Agent Card", + "tags": [ + "a2a_registration" + ] + } + } + } + }, "access_groups": { "components": { "schemas": { @@ -782,6 +957,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -1939,6 +2121,41 @@ "title": "AgentInterface", "type": "object" }, + "AgentKeySummary": { + "properties": { + "key_alias": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Key Alias" + }, + "key_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Key Name" + }, + "token": { + "title": "Token", + "type": "string" + } + }, + "required": [ + "token" + ], + "title": "AgentKeySummary", + "type": "object" + }, "AgentMakePublicResponse": { "properties": { "message": { @@ -2111,6 +2328,20 @@ ], "title": "Extra Headers" }, + "keys": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/AgentKeySummary" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Keys" + }, "litellm_params": { "anyOf": [ { @@ -2418,6 +2649,11 @@ "title": "Total Api Requests", "type": "integer" }, + "total_autorouter_savings_spend": { + "default": 0.0, + "title": "Total Autorouter Savings Spend", + "type": "number" + }, "total_cache_creation_input_tokens": { "default": 0, "title": "Total Cache Creation Input Tokens", @@ -2433,16 +2669,36 @@ "title": "Total Completion Tokens", "type": "integer" }, + "total_compression_saved_tokens": { + "default": 0, + "title": "Total Compression Saved Tokens", + "type": "integer" + }, + "total_compression_savings_spend": { + "default": 0.0, + "title": "Total Compression Savings Spend", + "type": "number" + }, "total_failed_requests": { "default": 0, "title": "Total Failed Requests", "type": "integer" }, + "total_flat_cost": { + "default": 0.0, + "title": "Total Flat Cost", + "type": "number" + }, "total_pages": { "default": 1, "title": "Total Pages", "type": "integer" }, + "total_prompt_caching_savings_spend": { + "default": 0.0, + "title": "Total Prompt Caching Savings Spend", + "type": "number" + }, "total_prompt_tokens": { "default": 0, "title": "Total Prompt Tokens", @@ -2504,8 +2760,7 @@ }, "required": [ "type", - "scheme", - "bearerFormat" + "scheme" ], "title": "HTTPAuthSecurityScheme", "type": "object" @@ -2670,8 +2925,7 @@ }, "required": [ "type", - "flows", - "oauth2MetadataUrl" + "flows" ], "title": "OAuth2SecurityScheme", "type": "object" @@ -2881,6 +3135,11 @@ "title": "Api Requests", "type": "integer" }, + "autorouter_savings_spend": { + "default": 0.0, + "title": "Autorouter Savings Spend", + "type": "number" + }, "cache_creation_input_tokens": { "default": 0, "title": "Cache Creation Input Tokens", @@ -2896,11 +3155,31 @@ "title": "Completion Tokens", "type": "integer" }, + "compression_saved_tokens": { + "default": 0, + "title": "Compression Saved Tokens", + "type": "integer" + }, + "compression_savings_spend": { + "default": 0.0, + "title": "Compression Savings Spend", + "type": "number" + }, "failed_requests": { "default": 0, "title": "Failed Requests", "type": "integer" }, + "flat_cost": { + "default": 0.0, + "title": "Flat Cost", + "type": "number" + }, + "prompt_caching_savings_spend": { + "default": 0.0, + "title": "Prompt Caching Savings Spend", + "type": "number" + }, "prompt_tokens": { "default": 0, "title": "Prompt Tokens", @@ -2927,6 +3206,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -3171,7 +3457,7 @@ ] }, "post": { - "description": "Create a new agent\n\nExample Request:\n```bash\ncurl -X POST \"http://localhost:4000/v1/agents\" \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"agent_name\": \"my-custom-agent\",\n \"agent_card_params\": {\n \"protocolVersion\": \"1.0\",\n \"name\": \"Hello World Agent\",\n \"description\": \"Just a hello world agent\",\n \"url\": \"http://localhost:9999/\",\n \"version\": \"1.0.0\",\n \"defaultInputModes\": [\"text\"],\n \"defaultOutputModes\": [\"text\"],\n \"capabilities\": {\n \"streaming\": true\n },\n \"skills\": [\n {\n \"id\": \"hello_world\",\n \"name\": \"Returns hello world\",\n \"description\": \"just returns hello world\",\n \"tags\": [\"hello world\"],\n \"examples\": [\"hi\", \"hello world\"]\n }\n ]\n },\n \"litellm_params\": {\n \"make_public\": true\n }\n }'\n```", + "description": "Create a new agent\n\nExample Request:\n```bash\ncurl -X POST \"http://localhost:4000/v1/agents\" \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"agent_name\": \"my-custom-agent\",\n \"agent_card_params\": {\n \"protocolVersion\": \"1.0\",\n \"name\": \"Hello World Agent\",\n \"description\": \"Just a hello world agent\",\n \"url\": \"http://localhost:9999/\",\n \"version\": \"1.0.0\",\n \"defaultInputModes\": [\"text\"],\n \"defaultOutputModes\": [\"text\"],\n \"capabilities\": {\n \"streaming\": true\n },\n \"skills\": [\n {\n \"id\": \"hello_world\",\n \"name\": \"Returns hello world\",\n \"description\": \"just returns hello world\",\n \"tags\": [\"hello world\"],\n \"examples\": [\"hi\", \"hello world\"]\n }\n ]\n },\n \"litellm_params\": {\n \"make_public\": true\n }\n }'\n```", "operationId": "create_agent_v1_agents_post", "requestBody": { "content": { @@ -3265,7 +3551,7 @@ }, "/v1/agents/{agent_id}": { "delete": { - "description": "Delete an agent\n\nExample Request:\n```bash\ncurl -X DELETE \"http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer \"\n```\n\nExample Response:\n```json\n{\n \"message\": \"Agent 123e4567-e89b-12d3-a456-426614174000 deleted successfully\"\n}\n```", + "description": "Delete an agent\n\nExample Request:\n```bash\ncurl -X DELETE \"http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer \"\n```\n\nExample Response:\n```json\n{\n \"message\": \"Agent 123e4567-e89b-12d3-a456-426614174000 deleted successfully\"\n}\n```", "operationId": "delete_agent_v1_agents__agent_id__delete", "parameters": [ { @@ -3309,7 +3595,7 @@ ] }, "get": { - "description": "Get a specific agent by ID\n\nExample Request:\n```bash\ncurl -X GET \"http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer \"\n```", + "description": "Get a specific agent by ID\n\nExample Request:\n```bash\ncurl -X GET \"http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer \"\n```", "operationId": "get_agent_by_id_v1_agents__agent_id__get", "parameters": [ { @@ -3355,7 +3641,7 @@ ] }, "patch": { - "description": "Update an existing agent\n\nExample Request:\n```bash\ncurl -X PUT \"http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"agent\": {\n \"agent_name\": \"updated-agent\",\n \"agent_card_params\": {\n \"protocolVersion\": \"1.0\",\n \"name\": \"Updated Agent\",\n \"description\": \"Updated description\",\n \"url\": \"http://localhost:9999/\",\n \"version\": \"1.1.0\",\n \"defaultInputModes\": [\"text\"],\n \"defaultOutputModes\": [\"text\"],\n \"capabilities\": {\n \"streaming\": true\n },\n \"skills\": []\n },\n \"litellm_params\": {\n \"make_public\": false\n }\n }\n }'\n```", + "description": "Update an existing agent\n\nExample Request:\n```bash\ncurl -X PATCH \"http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"agent_name\": \"updated-agent\",\n \"agent_card_params\": {\n \"protocolVersion\": \"1.0\",\n \"name\": \"Updated Agent\",\n \"description\": \"Updated description\",\n \"url\": \"http://localhost:9999/\",\n \"version\": \"1.1.0\",\n \"defaultInputModes\": [\"text\"],\n \"defaultOutputModes\": [\"text\"],\n \"capabilities\": {\n \"streaming\": true\n },\n \"skills\": []\n },\n \"litellm_params\": {\n \"make_public\": false\n }\n }'\n```", "operationId": "patch_agent_v1_agents__agent_id__patch", "parameters": [ { @@ -3411,7 +3697,7 @@ ] }, "put": { - "description": "Update an existing agent\n\nExample Request:\n```bash\ncurl -X PUT \"http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"agent\": {\n \"agent_name\": \"updated-agent\",\n \"agent_card_params\": {\n \"protocolVersion\": \"1.0\",\n \"name\": \"Updated Agent\",\n \"description\": \"Updated description\",\n \"url\": \"http://localhost:9999/\",\n \"version\": \"1.1.0\",\n \"defaultInputModes\": [\"text\"],\n \"defaultOutputModes\": [\"text\"],\n \"capabilities\": {\n \"streaming\": true\n },\n \"skills\": []\n },\n \"litellm_params\": {\n \"make_public\": false\n }\n }\n }'\n```", + "description": "Update an existing agent\n\nExample Request:\n```bash\ncurl -X PUT \"http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"agent_name\": \"updated-agent\",\n \"agent_card_params\": {\n \"protocolVersion\": \"1.0\",\n \"name\": \"Updated Agent\",\n \"description\": \"Updated description\",\n \"url\": \"http://localhost:9999/\",\n \"version\": \"1.1.0\",\n \"defaultInputModes\": [\"text\"],\n \"defaultOutputModes\": [\"text\"],\n \"capabilities\": {\n \"streaming\": true\n },\n \"skills\": []\n },\n \"litellm_params\": {\n \"make_public\": false\n }\n }'\n```", "operationId": "update_agent_v1_agents__agent_id__put", "parameters": [ { @@ -3535,6 +3821,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -3989,6 +4282,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -4963,7 +5263,7 @@ ] }, "post": { - "description": "Register a new plugin in the LiteLLM marketplace.\n\nLiteLLM acts as a registry/discovery layer. Plugins are hosted on\nGitHub/GitLab/Bitbucket. Claude Code will clone from the git source\nwhen users install.\n\nThis endpoint is create-only and never overwrites. If a plugin with\nthe same name already exists it returns 409 Conflict; use\nPUT /claude-code/plugins/{plugin_name} to update an existing plugin.\n\nParameters:\n - name: Plugin name (kebab-case)\n - source: Git source reference (github, url, or git-subdir format)\n - version: Semantic version (optional)\n - description: Plugin description (optional)\n - author: Author information (optional)\n - homepage: Plugin homepage URL (optional)\n - keywords: Search keywords (optional)\n - category: Plugin category (optional)\n\nReturns:\n Registration status (action is always \"created\") and plugin information.\n\nExample:\n ```bash\n curl -X POST http://localhost:4000/claude-code/plugins \\\n -H \"Authorization: Bearer sk-...\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"my-plugin\",\n \"source\": {\"source\": \"github\", \"repo\": \"org/my-plugin\"},\n \"version\": \"1.0.0\",\n \"description\": \"My awesome plugin\"\n }'\n ```", + "description": "Register a new plugin in the LiteLLM marketplace.\n\nLiteLLM acts as a registry/discovery layer. Plugins are hosted on\nGitHub/GitLab/Bitbucket. Claude Code will clone from the git source\nwhen users install.\n\nThis endpoint is create-only and never overwrites. If a plugin with\nthe same name already exists it returns 409 Conflict; use\nPUT /claude-code/plugins/{plugin_name} to update an existing plugin.\n\nRequires a proxy admin API key.\n\nParameters:\n - name: Plugin name (kebab-case)\n - source: Git source reference (github, url, or git-subdir format)\n - version: Semantic version (optional)\n - description: Plugin description (optional)\n - author: Author information (optional)\n - homepage: Plugin homepage URL (optional)\n - keywords: Search keywords (optional)\n - category: Plugin category (optional)\n\nReturns:\n Registration status (action is always \"created\") and plugin information.\n\nExample:\n ```bash\n curl -X POST http://localhost:4000/claude-code/plugins \\\n -H \"Authorization: Bearer sk-...\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"my-plugin\",\n \"source\": {\"source\": \"github\", \"repo\": \"org/my-plugin\"},\n \"version\": \"1.0.0\",\n \"description\": \"My awesome plugin\"\n }'\n ```", "operationId": "register_plugin_claude_code_plugins_post", "requestBody": { "content": { @@ -5010,7 +5310,7 @@ }, "/claude-code/plugins/{plugin_name}": { "delete": { - "description": "Delete a plugin from the marketplace.\n\nParameters:\n - plugin_name: The name of the plugin to delete", + "description": "Delete a plugin from the marketplace.\n\nRequires a proxy admin API key.\n\nParameters:\n - plugin_name: The name of the plugin to delete", "operationId": "delete_plugin_claude_code_plugins__plugin_name__delete", "parameters": [ { @@ -5098,7 +5398,7 @@ ] }, "put": { - "description": "Update an existing plugin in the LiteLLM marketplace.\n\nThe plugin is identified by its name in the path, which is the resource\nidentity and cannot be changed here. This is a full replace, not a merge:\nthe manifest is rebuilt from the request body, so any optional field left\nout is reset to its default (e.g. an omitted version is cleared, not kept).\nSend the full desired state.\n\nReturns 404 if no plugin with the given name exists; use\nPOST /claude-code/plugins to create a new plugin.\n\nParameters:\n - plugin_name: Name of the plugin to update (path parameter)\n - source: Git source reference (github, url, or git-subdir format)\n - version: Semantic version (optional)\n - description: Plugin description (optional)\n - author: Author information (optional)\n - homepage: Plugin homepage URL (optional)\n - keywords: Search keywords (optional)\n - category: Plugin category (optional)\n\nReturns:\n Update status (action is always \"updated\") and plugin information.\n\nExample:\n ```bash\n curl -X PUT http://localhost:4000/claude-code/plugins/my-plugin \\\n -H \"Authorization: Bearer sk-...\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"source\": {\"source\": \"github\", \"repo\": \"org/my-plugin\"},\n \"version\": \"2.0.0\",\n \"description\": \"My awesome plugin\"\n }'\n ```", + "description": "Update an existing plugin in the LiteLLM marketplace.\n\nThe plugin is identified by its name in the path, which is the resource\nidentity and cannot be changed here. This is a full replace, not a merge:\nthe manifest is rebuilt from the request body, so any optional field left\nout is reset to its default (e.g. an omitted version is cleared, not kept).\nSend the full desired state.\n\nReturns 404 if no plugin with the given name exists; use\nPOST /claude-code/plugins to create a new plugin.\n\nRequires a proxy admin API key.\n\nParameters:\n - plugin_name: Name of the plugin to update (path parameter)\n - source: Git source reference (github, url, or git-subdir format)\n - version: Semantic version (optional)\n - description: Plugin description (optional)\n - author: Author information (optional)\n - homepage: Plugin homepage URL (optional)\n - keywords: Search keywords (optional)\n - category: Plugin category (optional)\n\nReturns:\n Update status (action is always \"updated\") and plugin information.\n\nExample:\n ```bash\n curl -X PUT http://localhost:4000/claude-code/plugins/my-plugin \\\n -H \"Authorization: Bearer sk-...\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"source\": {\"source\": \"github\", \"repo\": \"org/my-plugin\"},\n \"version\": \"2.0.0\",\n \"description\": \"My awesome plugin\"\n }'\n ```", "operationId": "update_plugin_claude_code_plugins__plugin_name__put", "parameters": [ { @@ -5156,7 +5456,7 @@ }, "/claude-code/plugins/{plugin_name}/disable": { "post": { - "description": "Disable a plugin without deleting it.\n\nParameters:\n - plugin_name: The name of the plugin to disable", + "description": "Disable a plugin without deleting it.\n\nRequires a proxy admin API key.\n\nParameters:\n - plugin_name: The name of the plugin to disable", "operationId": "disable_plugin_claude_code_plugins__plugin_name__disable_post", "parameters": [ { @@ -5202,7 +5502,7 @@ }, "/claude-code/plugins/{plugin_name}/enable": { "post": { - "description": "Enable a disabled plugin.\n\nParameters:\n - plugin_name: The name of the plugin to enable", + "description": "Enable a disabled plugin.\n\nRequires a proxy admin API key.\n\nParameters:\n - plugin_name: The name of the plugin to enable", "operationId": "enable_plugin_claude_code_plugins__plugin_name__enable_post", "parameters": [ { @@ -5517,6 +5817,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -5929,6 +6236,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -6245,6 +6559,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -6283,6 +6604,26 @@ "delete": { "description": "Delete Hashicorp Vault configuration. Idempotent.", "operationId": "delete_hashicorp_vault_config_config_overrides_hashicorp_vault_delete", + "parameters": [ + { + "description": "The litellm-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability", + "in": "header", + "name": "litellm-changed-by", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The litellm-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability", + "title": "Litellm-Changed-By" + } + } + ], "responses": { "200": { "content": { @@ -6291,6 +6632,16 @@ } }, "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" } }, "security": [ @@ -6331,6 +6682,26 @@ "post": { "description": "Update Hashicorp Vault secret manager configuration.\nSets environment variables, encrypts sensitive fields, and stores in DB.\nReinitializes the secret manager on this pod.", "operationId": "update_hashicorp_vault_config_config_overrides_hashicorp_vault_post", + "parameters": [ + { + "description": "The litellm-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability", + "in": "header", + "name": "litellm-changed-by", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The litellm-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability", + "title": "Litellm-Changed-By" + } + } + ], "requestBody": { "content": { "application/json": { @@ -6932,6 +7303,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -7826,6 +8204,251 @@ } } }, + "gemini_agents": { + "components": { + "schemas": { + "HTTPValidationError": { + "properties": { + "detail": { + "items": { + "$ref": "#/components/schemas/ValidationError" + }, + "title": "Detail", + "type": "array" + } + }, + "title": "HTTPValidationError", + "type": "object" + }, + "ValidationError": { + "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "title": "Location", + "type": "array" + }, + "msg": { + "title": "Message", + "type": "string" + }, + "type": { + "title": "Error Type", + "type": "string" + } + }, + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError", + "type": "object" + } + } + }, + "paths": { + "/v1beta/agents": { + "get": { + "description": "List all custom agents on the Gemini side.\n\nPass per-request Gemini credentials via the JSON-encoded\n``litellm_params_template`` query parameter. Flat query parameters\n(e.g. ``?api_key=AIza...``) are intentionally ignored \u2014 see\n``_merge_query_params_into_data`` for the rationale.\n\n```bash\ncurl \"http://localhost:4000/v1beta/agents?litellm_params_template=%7B%22api_key%22%3A%22AIza...%22%7D\" \\\n -H \"Authorization: Bearer sk-...\"\n```", + "operationId": "list_gemini_agents_v1beta_agents_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "List Gemini Agents", + "tags": [ + "gemini_agents" + ] + }, + "post": { + "description": "Create a named custom agent on the Gemini side.\n\nExample:\n```bash\ncurl -X POST \"http://localhost:4000/v1beta/agents\" \\\n -H \"Authorization: Bearer sk-...\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"my-custom-slides-agent\",\n \"base_agent\": \"waverunner\",\n \"instructions\": \"You are a helpful assistant that creates slides.\",\n \"base_environment\": {\n \"type\": \"remote\",\n \"sources\": [\n {\"type\": \"gcs\", \"source\": \"gs://eap-templates/slides-skill\",\n \"target\": \"/.agents/skills/slides-skill\"}\n ]\n }\n }'\n```", + "operationId": "create_gemini_agent_v1beta_agents_post", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Create Gemini Agent", + "tags": [ + "gemini_agents" + ] + } + }, + "/v1beta/agents/{name}": { + "delete": { + "description": "Delete a custom agent by name.\n\nPass per-request Gemini credentials via the JSON-encoded\n``litellm_params_template`` query parameter. Flat query parameters\n(e.g. ``?api_key=AIza...``) are intentionally ignored \u2014 see\n``_merge_query_params_into_data`` for the rationale.\n\n```bash\ncurl -X DELETE \"http://localhost:4000/v1beta/agents/my-custom-slides-agent?litellm_params_template=%7B%22api_key%22%3A%22AIza...%22%7D\" \\\n -H \"Authorization: Bearer sk-...\"\n```", + "operationId": "delete_gemini_agent_v1beta_agents__name__delete", + "parameters": [ + { + "in": "path", + "name": "name", + "required": true, + "schema": { + "title": "Name", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Delete Gemini Agent", + "tags": [ + "gemini_agents" + ] + }, + "get": { + "description": "Get a specific custom agent by name.\n\nPass per-request Gemini credentials via the JSON-encoded\n``litellm_params_template`` query parameter. Flat query parameters\n(e.g. ``?api_key=AIza...``) are intentionally ignored \u2014 see\n``_merge_query_params_into_data`` for the rationale.\n\n```bash\ncurl \"http://localhost:4000/v1beta/agents/my-custom-slides-agent?litellm_params_template=%7B%22api_key%22%3A%22AIza...%22%7D\" \\\n -H \"Authorization: Bearer sk-...\"\n```", + "operationId": "get_gemini_agent_v1beta_agents__name__get", + "parameters": [ + { + "in": "path", + "name": "name", + "required": true, + "schema": { + "title": "Name", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Get Gemini Agent", + "tags": [ + "gemini_agents" + ] + } + }, + "/v1beta/agents/{name}/versions": { + "get": { + "description": "List versions of a custom agent.\n\nPass per-request Gemini credentials via the JSON-encoded\n``litellm_params_template`` query parameter. Flat query parameters\n(e.g. ``?api_key=AIza...``) are intentionally ignored \u2014 see\n``_merge_query_params_into_data`` for the rationale.\n\n```bash\ncurl \"http://localhost:4000/v1beta/agents/my-custom-slides-agent/versions?litellm_params_template=%7B%22api_key%22%3A%22AIza...%22%7D\" \\\n -H \"Authorization: Bearer sk-...\"\n```", + "operationId": "list_gemini_agent_versions_v1beta_agents__name__versions_get", + "parameters": [ + { + "in": "path", + "name": "name", + "required": true, + "schema": { + "title": "Name", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "List Gemini Agent Versions", + "tags": [ + "gemini_agents" + ] + } + } + } + }, "guardrails": { "components": { "schemas": { @@ -7917,7 +8540,7 @@ "title": "ApplyGuardrailResponse", "type": "object" }, - "BaseLitellmParams-Input": { + "BaseLitellmParams": { "additionalProperties": true, "properties": { "additional_provider_specific_params": { @@ -8121,7 +8744,7 @@ } ], "default": true, - "description": "Whether to fail the request if Model Armor encounters an error", + "description": "Whether to fail the request if the guardrail encounters an error. Implemented by guardrail='model_armor' and 'generic_guardrail_api'. True (default) raises the error. False logs a critical error and lets the request proceed, so only a valid guardrail response can block or modify it.", "title": "Fail On Error" }, "guard_name": { @@ -8196,6 +8819,22 @@ "description": "Optional field if guardrail requires a 'model' parameter", "title": "Model" }, + "on_sensitive_data": { + "anyOf": [ + { + "enum": [ + "block", + "route" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Action to take when sensitive data is detected. 'block' raises an exception (default behavior). 'route' reroutes the request to the model specified in sensitive_data_route_to_model.", + "title": "On Sensitive Data" + }, "on_violation": { "anyOf": [ { @@ -8212,6 +8851,19 @@ "description": "For /v1/realtime sessions: 'warn' speaks the violation message and continues; 'end_session' speaks the message and closes the connection.", "title": "On Violation" }, + "only_scan_new_messages": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": false, + "description": "When True, the guardrail only scans messages that have not already been scanned earlier in the same session (identified by litellm_session_id / session_id). Message content is hashed per session and cached; only the diff (new or edited messages) is sent to the guardrail provider on follow-up calls. Falls back to a full scan when the request has no session id or the cache is unavailable. Intended for blocking/detection guardrails; not applied when mask_request_content is set.", + "title": "Only Scan New Messages" + }, "pangea_input_recipe": { "anyOf": [ { @@ -8275,6 +8927,55 @@ "description": "The message the bot speaks aloud when a /v1/realtime guardrail fires. Falls back to violation_message_template if not set.", "title": "Realtime Violation Message" }, + "run_in_parallel": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "description": "When True, this pre_call or post_call guardrail runs concurrently with other opted-in guardrails of the same hook, after the sequential guardrails have run. Use only for block-only guardrails that inspect and reject; do not enable it for guardrails that modify the request or response (e.g. PII masking or sensitive-data routing), since parallel runs share one snapshot and their mutations would race.", + "title": "Run In Parallel" + }, + "sanitize_error_detail": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": true, + "description": "For guardrail='model_armor': omit the raw Model Armor response from caller-facing errors and logs by default. Set False to restore verbose output.", + "title": "Sanitize Error Detail" + }, + "scan_only_tool_results": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "description": "When True, unified guardrails only evaluate tool results, the untrusted data an agent feeds back into the model, and skip system, user, and assistant content. Intended for agent harnesses whose own prompt scaffolding is trusted but often trips prompt-attack detectors.", + "title": "Scan Only Tool Results" + }, + "sensitive_data_route_to_model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Model to route requests to when sensitive data is detected and on_sensitive_data='route'. This is typically an on-premise model for data privacy. The routing decision persists for the entire session.", + "title": "Sensitive Data Route To Model" + }, "severity_threshold": { "anyOf": [ { @@ -8296,9 +8997,47 @@ "type": "null" } ], - "description": "When True, unified guardrails skip system-role messages when building evaluation inputs (texts and structured_messages). When False, system messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_system_message_in_guardrail setting.", + "description": "When True, unified guardrails skip system-role messages when building evaluation inputs (texts and structured_messages). When False, system messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_system_message_in_guardrail setting. For Anthropic /v1/messages, the flag applies only to the trusted top-level system prompt. In-sequence system entries are untrusted client input and remain in texts and structured_messages.", "title": "Skip System Message In Guardrail" }, + "skip_tool_message_in_guardrail": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "description": "When True, unified guardrails skip tool-role messages when building evaluation inputs (texts and structured_messages). When False, tool messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_tool_message_in_guardrail setting.", + "title": "Skip Tool Message In Guardrail" + }, + "skip_unscannable_attachments": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": false, + "description": "Implemented by guardrail='model_armor'. When True, attachment references that carry no inline bytes (file_id, gs://, or http(s) URLs) pass through unscanned instead of blocking, while fail_on_error still governs real Model Armor API errors. Default False blocks them.", + "title": "Skip Unscannable Attachments" + }, + "sticky_session_routing": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": true, + "description": "When True (default), after sensitive data is detected and routed, all subsequent requests in the same session will continue routing to the same model.", + "title": "Sticky Session Routing" + }, "template_id": { "anyOf": [ { @@ -8311,9 +9050,21 @@ "description": "The ID of your Model Armor template", "title": "Template Id" }, + "timeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "description": "Per-request timeout for the guardrail provider API call (seconds). Accepts int, float, or numeric string; coerced to float on load. Each guardrail handler chooses its own default when unset.", + "title": "Timeout" + }, "unreachable_fallback": { "default": "fail_closed", - "description": "Behavior when a guardrail endpoint is unreachable due to network errors. NOTE: This is currently only implemented by guardrail='generic_guardrail_api'. 'fail_closed' raises an error (default). 'fail_open' logs a critical error and allows the request to proceed.", + "description": "Behavior when a guardrail endpoint is unreachable due to network errors. Implemented by guardrail='generic_guardrail_api', 'akto', 'vigil_guard', 'repelloai', 'headroom', and 'compresr'. 'fail_closed' raises an error (default). 'fail_open' logs a critical error and allows the request to proceed.", "enum": [ "fail_closed", "fail_open" @@ -8337,424 +9088,173 @@ "title": "BaseLitellmParams", "type": "object" }, - "BaseLitellmParams-Output": { - "additionalProperties": true, + "BedrockChecksConfigModel": { + "description": "Inline `checks` config for the resource-less Bedrock InvokeGuardrailChecks API.\n\nInclude only the checks you want to run; at least one must be set.", "properties": { - "additional_provider_specific_params": { + "contentFilter": { "anyOf": [ { - "additionalProperties": true, - "type": "object" + "$ref": "#/components/schemas/BedrockChecksContentFilterModel" }, { "type": "null" } - ], - "description": "Additional provider-specific parameters for generic guardrail APIs", - "title": "Additional Provider Specific Params" + ] }, - "api_base": { + "promptAttack": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/BedrockChecksPromptAttackModel" }, { "type": "null" } - ], - "description": "Base URL for the guardrail service API", - "title": "Api Base" + ] }, - "api_endpoint": { + "sensitiveInformation": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/BedrockChecksSensitiveInformationModel" }, { "type": "null" } - ], - "description": "Optional custom API endpoint for Model Armor", - "title": "Api Endpoint" - }, - "api_key": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "API key for the guardrail service", - "title": "Api Key" - }, - "blocked_words": { - "anyOf": [ - { - "items": { - "$ref": "#/components/schemas/BlockedWord" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "description": "List of blocked words with individual actions", - "title": "Blocked Words" - }, - "blocked_words_file": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Path to YAML file containing blocked_words list", - "title": "Blocked Words File" - }, - "categories": { - "anyOf": [ - { - "items": { - "$ref": "#/components/schemas/ContentFilterCategoryConfig" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "description": "List of prebuilt categories to enable (harmful_*, bias_*)", - "title": "Categories" - }, - "category_thresholds": { - "anyOf": [ - { - "$ref": "#/components/schemas/LakeraCategoryThresholds" - }, - { - "type": "null" - } - ], - "description": "Threshold configuration for Lakera guardrail categories" - }, - "credentials": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Path to Google Cloud credentials JSON file or JSON string", - "title": "Credentials" - }, - "custom_code": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Python-like code containing the apply_guardrail function for custom guardrail logic", - "title": "Custom Code" - }, - "default_on": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "description": "Whether the guardrail is enabled by default", - "title": "Default On" - }, - "detect_secrets_config": { - "anyOf": [ - { - "additionalProperties": true, - "type": "object" - }, - { - "type": "null" - } - ], - "description": "Configuration for detect-secrets guardrail", - "title": "Detect Secrets Config" - }, - "end_session_after_n_fails": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "description": "For /v1/realtime sessions: automatically close the session after this many guardrail violations.", - "title": "End Session After N Fails" - }, - "experimental_use_latest_role_message_only": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "description": "When True, guardrails only receive the latest message for the relevant role (e.g., newest user input pre-call, newest assistant output post-call)", - "title": "Experimental Use Latest Role Message Only" - }, - "extra_headers": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "description": "Header names to forward from the client request to the guardrail (e.g. x-request-id). Only these headers' values are sent; others may be omitted or sent as [present]. Used by generic_guardrail_api (similar to MCP extra_headers).", - "title": "Extra Headers" - }, - "fail_on_error": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": true, - "description": "Whether to fail the request if Model Armor encounters an error", - "title": "Fail On Error" - }, - "guard_name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Name of the guardrail in guardrails.ai", - "title": "Guard Name" - }, - "keyword_redaction_tag": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Tag to use for keyword redaction", - "title": "Keyword Redaction Tag" - }, - "location": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Google Cloud location/region (e.g., us-central1)", - "title": "Location" - }, - "mask_request_content": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "description": "Will mask request content if guardrail makes any changes", - "title": "Mask Request Content" - }, - "mask_response_content": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "description": "Will mask response content if guardrail makes any changes", - "title": "Mask Response Content" - }, - "model": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Optional field if guardrail requires a 'model' parameter", - "title": "Model" - }, - "on_violation": { - "anyOf": [ - { - "enum": [ - "warn", - "end_session" - ], - "type": "string" - }, - { - "type": "null" - } - ], - "description": "For /v1/realtime sessions: 'warn' speaks the violation message and continues; 'end_session' speaks the message and closes the connection.", - "title": "On Violation" - }, - "pangea_input_recipe": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Recipe for input (LLM request)", - "title": "Pangea Input Recipe" - }, - "pangea_output_recipe": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Recipe for output (LLM response)", - "title": "Pangea Output Recipe" - }, - "pattern_redaction_format": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Format string for pattern redaction (use {pattern_name} placeholder)", - "title": "Pattern Redaction Format" - }, - "patterns": { - "anyOf": [ - { - "items": { - "$ref": "#/components/schemas/ContentFilterPattern" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "description": "List of patterns (prebuilt or custom regex) to detect", - "title": "Patterns" - }, - "realtime_violation_message": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "The message the bot speaks aloud when a /v1/realtime guardrail fires. Falls back to violation_message_template if not set.", - "title": "Realtime Violation Message" - }, - "severity_threshold": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Minimum severity to block (high, medium, low)", - "title": "Severity Threshold" - }, - "skip_system_message_in_guardrail": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "description": "When True, unified guardrails skip system-role messages when building evaluation inputs (texts and structured_messages). When False, system messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_system_message_in_guardrail setting.", - "title": "Skip System Message In Guardrail" - }, - "template_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "The ID of your Model Armor template", - "title": "Template Id" - }, - "unreachable_fallback": { - "default": "fail_closed", - "description": "Behavior when a guardrail endpoint is unreachable due to network errors. NOTE: This is currently only implemented by guardrail='generic_guardrail_api'. 'fail_closed' raises an error (default). 'fail_open' logs a critical error and allows the request to proceed.", - "enum": [ - "fail_closed", - "fail_open" - ], - "title": "Unreachable Fallback", - "type": "string" - }, - "violation_message_template": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Custom message when a guardrail blocks an action. Supports placeholders like {tool_name}, {rule_id}, and {default_message}.", - "title": "Violation Message Template" + ] } }, - "title": "BaseLitellmParams", + "title": "BedrockChecksConfigModel", + "type": "object" + }, + "BedrockChecksContentFilterCategoryItem": { + "properties": { + "category": { + "enum": [ + "VIOLENCE", + "HATE", + "SEXUAL", + "MISCONDUCT", + "INSULTS" + ], + "title": "Category", + "type": "string" + } + }, + "required": [ + "category" + ], + "title": "BedrockChecksContentFilterCategoryItem", + "type": "object" + }, + "BedrockChecksContentFilterModel": { + "properties": { + "categories": { + "items": { + "$ref": "#/components/schemas/BedrockChecksContentFilterCategoryItem" + }, + "title": "Categories", + "type": "array" + } + }, + "required": [ + "categories" + ], + "title": "BedrockChecksContentFilterModel", + "type": "object" + }, + "BedrockChecksPromptAttackCategoryItem": { + "properties": { + "category": { + "enum": [ + "JAILBREAK", + "PROMPT_INJECTION", + "PROMPT_LEAKAGE" + ], + "title": "Category", + "type": "string" + } + }, + "required": [ + "category" + ], + "title": "BedrockChecksPromptAttackCategoryItem", + "type": "object" + }, + "BedrockChecksPromptAttackModel": { + "properties": { + "categories": { + "items": { + "$ref": "#/components/schemas/BedrockChecksPromptAttackCategoryItem" + }, + "title": "Categories", + "type": "array" + } + }, + "required": [ + "categories" + ], + "title": "BedrockChecksPromptAttackModel", + "type": "object" + }, + "BedrockChecksSensitiveInformationEntityItem": { + "properties": { + "type": { + "enum": [ + "ADDRESS", + "AGE", + "AWS_ACCESS_KEY", + "AWS_SECRET_KEY", + "CA_HEALTH_NUMBER", + "CA_SOCIAL_INSURANCE_NUMBER", + "CREDIT_DEBIT_CARD_CVV", + "CREDIT_DEBIT_CARD_EXPIRY", + "CREDIT_DEBIT_CARD_NUMBER", + "DRIVER_ID", + "EMAIL", + "INTERNATIONAL_BANK_ACCOUNT_NUMBER", + "IP_ADDRESS", + "LICENSE_PLATE", + "MAC_ADDRESS", + "NAME", + "PASSWORD", + "PHONE", + "PIN", + "SWIFT_CODE", + "UK_NATIONAL_HEALTH_SERVICE_NUMBER", + "UK_NATIONAL_INSURANCE_NUMBER", + "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER", + "URL", + "USERNAME", + "US_BANK_ACCOUNT_NUMBER", + "US_BANK_ROUTING_NUMBER", + "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER", + "US_PASSPORT_NUMBER", + "US_SOCIAL_SECURITY_NUMBER", + "VEHICLE_IDENTIFICATION_NUMBER" + ], + "title": "Type", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "BedrockChecksSensitiveInformationEntityItem", + "type": "object" + }, + "BedrockChecksSensitiveInformationModel": { + "properties": { + "entities": { + "items": { + "$ref": "#/components/schemas/BedrockChecksSensitiveInformationEntityItem" + }, + "title": "Entities", + "type": "array" + } + }, + "required": [ + "entities" + ], + "title": "BedrockChecksSensitiveInformationModel", "type": "object" }, "BlockedWord": { @@ -8789,6 +9289,187 @@ "title": "BlockedWord", "type": "object" }, + "CiscoAIDefenseGuardrailConfigModelOptionalParams": { + "additionalProperties": true, + "description": "Optional parameters for the Cisco AI Defense guardrail.", + "properties": { + "enabled_rules": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/CiscoAIDefenseRule" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Explicit list of Cisco AI Defense rules to evaluate. If omitted, the policies configured for the API key in the Cisco AI Defense UI are used.", + "title": "Enabled Rules" + }, + "fallback_on_error": { + "anyOf": [ + { + "enum": [ + "allow", + "block" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "block", + "description": "Behaviour when the Cisco AI Defense API is unavailable: 'allow' proceeds without scanning (high availability), 'block' rejects the request (maximum security).", + "title": "Fallback On Error" + }, + "inspect_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Override for the inspection endpoint path. Defaults to /api/v1/inspect/chat when inspection_type='chat' and /api/v1/inspect/mcp when inspection_type='mcp'.", + "title": "Inspect Path" + }, + "inspection_type": { + "default": "chat", + "description": "Which Cisco AI Defense inspection surface to use. 'chat' scans LLM model conversations via /api/v1/inspect/chat. 'mcp' scans MCP tool calls via /api/v1/inspect/mcp. Each guardrail instance targets exactly one surface; configure two guardrails to scan both chat and MCP traffic.", + "enum": [ + "chat", + "mcp" + ], + "title": "Inspection Type", + "type": "string" + }, + "integration_profile_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Integration profile id to apply (advanced).", + "title": "Integration Profile Id" + }, + "integration_profile_version": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Integration profile version to apply (advanced).", + "title": "Integration Profile Version" + }, + "integration_tenant_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Integration tenant id to apply (advanced).", + "title": "Integration Tenant Id" + }, + "integration_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Integration type to apply (advanced).", + "title": "Integration Type" + }, + "on_flagged_action": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": "block", + "description": "Action to take when Cisco AI Defense flags content. 'block' raises an HTTPException; 'monitor' logs the detection and lets the request continue.", + "title": "On Flagged Action" + }, + "timeout": { + "anyOf": [ + { + "maximum": 60.0, + "minimum": 1.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": 10.0, + "description": "Timeout (seconds) for Cisco AI Defense API calls (1-60).", + "title": "Timeout" + } + }, + "title": "CiscoAIDefenseGuardrailConfigModelOptionalParams", + "type": "object" + }, + "CiscoAIDefenseRule": { + "description": "A single rule to enable for Cisco AI Defense inspection.", + "properties": { + "entity_types": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Optional list of entity types for the rule (e.g. 'Email Address', 'Phone Number'). Applies to rules such as PII, PCI, and PHI.", + "title": "Entity Types" + }, + "rule_name": { + "description": "The canonical Cisco AI Defense rule name to evaluate.", + "enum": [ + "Code Detection", + "Harassment", + "Hate Speech", + "PCI", + "PHI", + "PII", + "Prompt Injection", + "Profanity", + "Sexual Content & Exploitation", + "Social Division & Polarization", + "Violence & Public Safety Threats" + ], + "title": "Rule Name", + "type": "string" + } + }, + "required": [ + "rule_name" + ], + "title": "CiscoAIDefenseRule", + "type": "object" + }, "ContentFilterAction": { "description": "Action to take when content filter detects a match", "enum": [ @@ -8933,106 +9614,6 @@ "title": "GUARDRAIL_DEFINITION_LOCATION", "type": "string" }, - "GraySwanGuardrailConfigModelOptionalParams": { - "description": "Optional parameters for the Gray Swan guardrail.", - "properties": { - "categories": { - "anyOf": [ - { - "additionalProperties": { - "type": "string" - }, - "type": "object" - }, - { - "type": "null" - } - ], - "description": "Default Gray Swan category definitions to send with each request.", - "title": "Categories" - }, - "fail_open": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": true, - "description": "If true (default), errors contacting Gray Swan are logged and the request proceeds. If false, errors propagate and block the request.", - "title": "Fail Open" - }, - "guardrail_timeout": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": 30.0, - "description": "Timeout in seconds for calling the Gray Swan guardrail service.", - "title": "Guardrail Timeout" - }, - "on_flagged_action": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": "passthrough", - "description": "Action when a violation is detected: 'block' rejects the call (400 error), 'monitor' logs only, 'passthrough' replaces response content with violation message (200 status).", - "title": "On Flagged Action" - }, - "policy_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Gray Swan policy identifier to apply during monitoring.", - "title": "Policy Id" - }, - "reasoning_mode": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Gray Swan reasoning mode override. Accepted values: 'off', 'hybrid', 'thinking'.", - "title": "Reasoning Mode" - }, - "violation_threshold": { - "anyOf": [ - { - "maximum": 1.0, - "minimum": 0.0, - "type": "number" - }, - { - "type": "null" - } - ], - "default": 0.5, - "description": "Threshold between 0 and 1 at which Gray Swan violations trigger the configured action.", - "title": "Violation Threshold" - } - }, - "title": "GraySwanGuardrailConfigModelOptionalParams", - "type": "object" - }, "Guardrail": { "properties": { "created_at": { @@ -9156,7 +9737,7 @@ "litellm_params": { "anyOf": [ { - "$ref": "#/components/schemas/BaseLitellmParams-Output" + "$ref": "#/components/schemas/BaseLitellmParams" }, { "type": "null" @@ -9506,7 +10087,7 @@ "type": "null" } ], - "description": "Base URL for the Lakera AI API", + "description": "Regional base URL for the Cisco AI Defense Inspection API. Defaults to https://us.api.inspect.aidefense.security.cisco.com. Supported regions: us (us-west-2), ap (ap-ne-1), eu (eu-central-1). The environment variable `CISCO_AI_DEFENSE_API_BASE` is consulted as a fallback. The endpoint path is derived from inspection_type (/api/v1/inspect/chat for 'chat', /api/v1/inspect/mcp for 'mcp').", "title": "Api Base" }, "api_endpoint": { @@ -9542,7 +10123,7 @@ "type": "null" } ], - "description": "API key for the Lakera AI service", + "description": "API key for the Cisco AI Defense inspection endpoint. If not provided, the `CISCO_AI_DEFENSE_API_KEY` environment variable is used. Sent in the `X-Cisco-AI-Defense-API-Key` header. Both the chat and MCP endpoints use this key.", "title": "Api Key" }, "api_version": { @@ -9597,6 +10178,18 @@ "description": "Custom assertions to validate against the output. Each assertion is a string describing a condition.", "title": "Assertions" }, + "asset_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Repello asset ID whose dashboard policies are enforced. Required; the guardrail raises at init if it is missing.", + "title": "Asset Id" + }, "async_mode": { "anyOf": [ { @@ -9887,6 +10480,24 @@ ], "description": "Threshold configuration for Lakera guardrail categories" }, + "checks": { + "anyOf": [ + { + "$ref": "#/components/schemas/BedrockChecksConfigModel" + }, + { + "type": "null" + } + ], + "description": "Inline safeguards for the resource-less InvokeGuardrailChecks API (contentFilter / promptAttack / sensitiveInformation). When set, the guardrail calls InvokeGuardrailChecks instead of ApplyGuardrail and no guardrailIdentifier is required. Mutually exclusive with guardrailIdentifier." + }, + "chunk_budget_chars": { + "default": 25000, + "description": "ApplyGuardrail: batch size, in characters, used to re-send content after AWS has rejected a request as too large. Requests AWS accepts are always sent in a single call, so this has no effect until a rejection happens. Defaults to 25,000; a batch AWS still rejects is bisected automatically, so this value only trades round trips against batch size and cannot fail a request on its own.", + "exclusiveMinimum": 0.0, + "title": "Chunk Budget Chars", + "type": "integer" + }, "confidence_threshold": { "default": 0.5, "default_value": 0.5, @@ -9913,6 +10524,21 @@ "description": "Additional configuration for the guardrail", "title": "Config" }, + "content_filter_threshold": { + "anyOf": [ + { + "maximum": 1.0, + "minimum": 0.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": 0.5, + "description": "InvokeGuardrailChecks: block when any contentFilter severityScore >= this value (scores are in [0,1]). Set to null to make the content filter detect-only (logged, never blocks).", + "title": "Content Filter Threshold" + }, "content_moderation_check": { "anyOf": [ { @@ -9949,6 +10575,18 @@ "description": "Python-like code containing the apply_guardrail function for custom guardrail logic", "title": "Custom Code" }, + "deepkeep_firewall_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The DeepKeep Firewall ID to use for guardrail evaluation. If not provided, the `DEEPKEEP_FIREWALL_ID` environment variable is checked.", + "title": "Deepkeep Firewall Id" + }, "default_action": { "default": "deny", "description": "Fallback decision when no rule matches", @@ -10115,7 +10753,7 @@ } ], "default": true, - "description": "Whether to fail the request if Model Armor encounters an error", + "description": "Whether to fail the request if the guardrail encounters an error. Implemented by guardrail='model_armor' and 'generic_guardrail_api'. True (default) raises the error. False logs a critical error and lets the request proceed, so only a valid guardrail response can block or modify it.", "title": "Fail On Error" }, "grounding_check": { @@ -10388,7 +11026,7 @@ "type": "null" } ], - "description": "Optional field if guardrail requires a 'model' parameter", + "description": "Model name forwarded to the headroom /v1/compress endpoint.", "title": "Model" }, "monitor_mode": { @@ -10443,6 +11081,22 @@ "description": "Action to take when content is flagged: 'block' (raise exception) or 'monitor' (log only)", "title": "On Flagged Action" }, + "on_sensitive_data": { + "anyOf": [ + { + "enum": [ + "block", + "route" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Action to take when sensitive data is detected. 'block' raises an exception (default behavior). 'route' reroutes the request to the model specified in sensitive_data_route_to_model.", + "title": "On Sensitive Data" + }, "on_violation": { "anyOf": [ { @@ -10459,10 +11113,23 @@ "description": "For /v1/realtime sessions: 'warn' speaks the violation message and continues; 'end_session' speaks the message and closes the connection.", "title": "On Violation" }, + "only_scan_new_messages": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": false, + "description": "When True, the guardrail only scans messages that have not already been scanned earlier in the same session (identified by litellm_session_id / session_id). Message content is hashed per session and cached; only the diff (new or edited messages) is sent to the guardrail provider on follow-up calls. Falls back to a full scan when the request has no session id or the cache is unavailable. Intended for blocking/detection guardrails; not applied when mask_request_content is set.", + "title": "Only Scan New Messages" + }, "optional_params": { "anyOf": [ { - "$ref": "#/components/schemas/GraySwanGuardrailConfigModelOptionalParams" + "$ref": "#/components/schemas/CiscoAIDefenseGuardrailConfigModelOptionalParams" }, { "type": "null" @@ -10571,6 +11238,21 @@ "description": "Enable PII (Personally Identifiable Information) detection.", "title": "Pii Check" }, + "pii_confidence_threshold": { + "anyOf": [ + { + "maximum": 1.0, + "minimum": 0.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": 0.5, + "description": "InvokeGuardrailChecks: block when any sensitiveInformation confidenceScore >= this value (scores are in [0,1]). Set to null to make PII detection detect-only.", + "title": "Pii Confidence Threshold" + }, "pii_entities_config": { "anyOf": [ { @@ -10634,6 +11316,30 @@ "title": "Policy Names", "ui_type": "multiselect" }, + "post_checkpoint_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Post-checkpoint ID for the Ovalix Tracker service.", + "title": "Post Checkpoint Id" + }, + "pre_checkpoint_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Pre-checkpoint ID for the Ovalix Tracker service.", + "title": "Pre Checkpoint Id" + }, "presidio_ad_hoc_recognizers": { "anyOf": [ { @@ -10766,6 +11472,21 @@ "description": "Project ID for the Lakera AI project", "title": "Project Id" }, + "prompt_attack_threshold": { + "anyOf": [ + { + "maximum": 1.0, + "minimum": 0.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": 0.5, + "description": "InvokeGuardrailChecks: block when any promptAttack severityScore >= this value (scores are in [0,1]). Set to null to make prompt-attack detection detect-only.", + "title": "Prompt Attack Threshold" + }, "prompt_injections": { "anyOf": [ { @@ -10805,6 +11526,43 @@ "description": "Ordered allow/deny rules. Patterns use regex for tool names/types and optional regex constraints on tool arguments.", "title": "Rules" }, + "run_in_parallel": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "description": "When True, this pre_call or post_call guardrail runs concurrently with other opted-in guardrails of the same hook, after the sequential guardrails have run. Use only for block-only guardrails that inspect and reject; do not enable it for guardrails that modify the request or response (e.g. PII masking or sensitive-data routing), since parallel runs share one snapshot and their mutations would race.", + "title": "Run In Parallel" + }, + "sanitize_error_detail": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": true, + "description": "For guardrail='model_armor': omit the raw Model Armor response from caller-facing errors and logs by default. Set False to restore verbose output.", + "title": "Sanitize Error Detail" + }, + "scan_only_tool_results": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "description": "When True, unified guardrails only evaluate tool results, the untrusted data an agent feeds back into the model, and skip system, user, and assistant content. Intended for agent harnesses whose own prompt scaffolding is trusted but often trips prompt-attack detectors.", + "title": "Scan Only Tool Results" + }, "send_user_api_key_alias": { "anyOf": [ { @@ -10844,6 +11602,18 @@ "description": "Whether to send user_API_key_user_id in headers", "title": "Send User Api Key User Id" }, + "sensitive_data_route_to_model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Model to route requests to when sensitive data is detected and on_sensitive_data='route'. This is typically an on-premise model for data privacy. The routing decision persists for the entire session.", + "title": "Sensitive Data Route To Model" + }, "severity_threshold": { "anyOf": [ { @@ -10856,6 +11626,54 @@ "description": "Minimum severity to block (high, medium, low)", "title": "Severity Threshold" }, + "singulr_api_base": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The Singulr API base URL. Get base URL from Singulr Platform.", + "title": "Singulr Api Base" + }, + "singulr_api_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The Singulr API key. Generate API key from Singulr Platform.", + "title": "Singulr Api Key" + }, + "singulr_application_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The Singulr application ID. Get application ID from Singulr Platform.", + "title": "Singulr Application Id" + }, + "singulr_guardrail_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The Singulr Guardrail ID. Get guardrail ID from Singulr Platform.", + "title": "Singulr Guardrail Id" + }, "skip_system_message_in_guardrail": { "anyOf": [ { @@ -10865,9 +11683,47 @@ "type": "null" } ], - "description": "When True, unified guardrails skip system-role messages when building evaluation inputs (texts and structured_messages). When False, system messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_system_message_in_guardrail setting.", + "description": "When True, unified guardrails skip system-role messages when building evaluation inputs (texts and structured_messages). When False, system messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_system_message_in_guardrail setting. For Anthropic /v1/messages, the flag applies only to the trusted top-level system prompt. In-sequence system entries are untrusted client input and remain in texts and structured_messages.", "title": "Skip System Message In Guardrail" }, + "skip_tool_message_in_guardrail": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "description": "When True, unified guardrails skip tool-role messages when building evaluation inputs (texts and structured_messages). When False, tool messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_tool_message_in_guardrail setting.", + "title": "Skip Tool Message In Guardrail" + }, + "skip_unscannable_attachments": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": false, + "description": "Implemented by guardrail='model_armor'. When True, attachment references that carry no inline bytes (file_id, gs://, or http(s) URLs) pass through unscanned instead of blocking, while fail_on_error still governs real Model Armor API errors. Default False blocks them.", + "title": "Skip Unscannable Attachments" + }, + "sticky_session_routing": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": true, + "description": "When True (default), after sensitive data is detected and routed, all subsequent requests in the same session will continue routing to the same model.", + "title": "Sticky Session Routing" + }, "template_id": { "anyOf": [ { @@ -10880,6 +11736,18 @@ "description": "The ID of your Model Armor template", "title": "Template Id" }, + "timeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "description": "Per-request timeout for the guardrail provider API call (seconds). Accepts int, float, or numeric string; coerced to float on load. Each guardrail handler chooses its own default when unset.", + "title": "Timeout" + }, "tool_selection_quality_check": { "anyOf": [ { @@ -10892,9 +11760,33 @@ "description": "Enable tool selection quality check to evaluate quality of tool/function calls.", "title": "Tool Selection Quality Check" }, + "tracker_api_base": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Base URL for the Ovalix Tracker service.", + "title": "Tracker Api Base" + }, + "tracker_api_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "API key for the Ovalix Tracker service.", + "title": "Tracker Api Key" + }, "unreachable_fallback": { "default": "fail_closed", - "description": "What to do when Akto is unreachable. 'fail_open' = allow, 'fail_closed' = block.", + "description": "Behavior when the headroom compression service is unreachable or errors. 'fail_closed' raises an error (default). 'fail_open' logs a critical error and forwards the request uncompressed instead of blocking it.", "enum": [ "fail_closed", "fail_open" @@ -11046,7 +11938,7 @@ "litellm_params": { "anyOf": [ { - "$ref": "#/components/schemas/BaseLitellmParams-Input" + "$ref": "#/components/schemas/BaseLitellmParams" }, { "type": "null" @@ -11086,6 +11978,9 @@ "US_SSN", "UK_NHS", "UK_NINO", + "UK_PASSPORT", + "UK_POSTCODE", + "UK_VEHICLE_REGISTRATION", "ES_NIF", "ES_NIE", "IT_FISCAL_CODE", @@ -11789,6 +12684,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -13309,6 +14211,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -13609,6 +14518,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -13860,6 +14776,17 @@ }, "MCPCredentials": { "properties": { + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, "auth_value": { "anyOf": [ { @@ -13948,6 +14875,17 @@ ], "title": "Aws Session Token" }, + "client_assertion_signing_alg": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Assertion Signing Alg" + }, "client_id": { "anyOf": [ { @@ -13959,6 +14897,28 @@ ], "title": "Client Id" }, + "client_private_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Private Key" + }, + "client_private_key_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Private Key Id" + }, "client_secret": { "anyOf": [ { @@ -13970,6 +14930,42 @@ ], "title": "Client Secret" }, + "id_jag_resource": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id Jag Resource" + }, + "id_jag_resource_token_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id Jag Resource Token Endpoint" + }, + "redirect_uris": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Redirect Uris" + }, "scopes": { "anyOf": [ { @@ -13983,11 +14979,113 @@ } ], "title": "Scopes" + }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, + "token_endpoint_auth_method": { + "anyOf": [ + { + "enum": [ + "client_secret_basic", + "client_secret_post" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Endpoint Auth Method" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, + "upstream_resource": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Upstream Resource" } }, "title": "MCPCredentials", "type": "object" }, + "MCPEnvVar": { + "description": "One environment variable for an MCP server.\n\nVariables can be interpolated into ``static_headers`` using ``${NAME}``\nsyntax. ``scope=global`` values are stored on the server. ``scope=user``\nvalues are stored per-user in ``LiteLLM_MCPUserEnvVars`` and supplied by\neach user.", + "properties": { + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + }, + "name": { + "title": "Name", + "type": "string" + }, + "scope": { + "$ref": "#/components/schemas/MCPEnvVarScope", + "default": "global" + }, + "value": { + "default": "", + "title": "Value", + "type": "string" + } + }, + "required": [ + "name" + ], + "title": "MCPEnvVar", + "type": "object" + }, + "MCPEnvVarScope": { + "description": "Scope for an MCP server environment variable.\n\n- ``global``: value is provided by the admin and used for all users.\n- ``user``: each user must provide their own value via the per-user\n env-var endpoint. The admin-supplied ``value`` is treated as a\n placeholder/hint and is not used at request time.", + "enum": [ + "global", + "user" + ], + "title": "MCPEnvVarScope", + "type": "string" + }, "NewMCPServerRequest": { "properties": { "alias": { @@ -14039,6 +15137,17 @@ "title": "Args", "type": "array" }, + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, "auth_type": { "anyOf": [ { @@ -14050,7 +15159,11 @@ "authorization", "oauth2", "aws_sigv4", - "token" + "token", + "oauth2_token_exchange", + "oauth2_id_jag", + "true_passthrough", + "oauth_delegate" ], "type": "string" }, @@ -14115,6 +15228,22 @@ } ] }, + "dcr_bridge": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Dcr Bridge" + }, + "delegate_auth_to_upstream": { + "default": false, + "title": "Delegate Auth To Upstream", + "type": "boolean" + }, "description": { "anyOf": [ { @@ -14133,6 +15262,20 @@ "title": "Env", "type": "object" }, + "env_vars": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/MCPEnvVar" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Env Vars" + }, "extra_headers": { "anyOf": [ { @@ -14163,6 +15306,28 @@ "title": "Is Byok", "type": "boolean" }, + "issuer": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Issuer" + }, + "max_concurrent_requests": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Max Concurrent Requests" + }, "mcp_access_groups": { "items": { "type": "string" @@ -14197,6 +15362,11 @@ ], "title": "Oauth2 Flow" }, + "oauth_passthrough": { + "default": false, + "title": "Oauth Passthrough", + "type": "boolean" + }, "registration_url": { "anyOf": [ { @@ -14266,6 +15436,17 @@ ], "title": "Static Headers" }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, "submitted_at": { "anyOf": [ { @@ -14291,6 +15472,39 @@ "description": "Server-managed: set by the endpoint; caller values are overridden.", "title": "Submitted By" }, + "timeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Timeout" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, "token_url": { "anyOf": [ { @@ -14357,6 +15571,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -14391,6 +15612,134 @@ } }, "paths": { + "/mcp": { + "delete": { + "description": "Serve the aggregate MCP endpoint on the bare ``/mcp`` spelling: the\n``/mcp`` mount cannot match its bare prefix, and the resulting 307 breaks\nMCP clients behind TLS-terminating proxies.", + "operationId": "aggregate_mcp_route_mcp_delete", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Aggregate Mcp Route", + "tags": [ + "mcp_app" + ] + }, + "get": { + "description": "Serve the aggregate MCP endpoint on the bare ``/mcp`` spelling: the\n``/mcp`` mount cannot match its bare prefix, and the resulting 307 breaks\nMCP clients behind TLS-terminating proxies.", + "operationId": "aggregate_mcp_route_mcp_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Aggregate Mcp Route", + "tags": [ + "mcp_app" + ] + }, + "head": { + "description": "Serve the aggregate MCP endpoint on the bare ``/mcp`` spelling: the\n``/mcp`` mount cannot match its bare prefix, and the resulting 307 breaks\nMCP clients behind TLS-terminating proxies.", + "operationId": "aggregate_mcp_route_mcp_head", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Aggregate Mcp Route", + "tags": [ + "mcp_app" + ] + }, + "options": { + "description": "Serve the aggregate MCP endpoint on the bare ``/mcp`` spelling: the\n``/mcp`` mount cannot match its bare prefix, and the resulting 307 breaks\nMCP clients behind TLS-terminating proxies.", + "operationId": "aggregate_mcp_route_mcp_options", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Aggregate Mcp Route", + "tags": [ + "mcp_app" + ] + }, + "patch": { + "description": "Serve the aggregate MCP endpoint on the bare ``/mcp`` spelling: the\n``/mcp`` mount cannot match its bare prefix, and the resulting 307 breaks\nMCP clients behind TLS-terminating proxies.", + "operationId": "aggregate_mcp_route_mcp_patch", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Aggregate Mcp Route", + "tags": [ + "mcp_app" + ] + }, + "post": { + "description": "Serve the aggregate MCP endpoint on the bare ``/mcp`` spelling: the\n``/mcp`` mount cannot match its bare prefix, and the resulting 307 breaks\nMCP clients behind TLS-terminating proxies.", + "operationId": "aggregate_mcp_route_mcp_post", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Aggregate Mcp Route", + "tags": [ + "mcp_app" + ] + }, + "put": { + "description": "Serve the aggregate MCP endpoint on the bare ``/mcp`` spelling: the\n``/mcp`` mount cannot match its bare prefix, and the resulting 307 breaks\nMCP clients behind TLS-terminating proxies.", + "operationId": "aggregate_mcp_route_mcp_put", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Aggregate Mcp Route", + "tags": [ + "mcp_app" + ] + } + }, "/mcp-rest/test/connection": { "post": { "description": "Test if we can connect to the provided MCP server before adding it", @@ -14508,7 +15857,7 @@ }, "/mcp-rest/tools/list": { "get": { - "description": "List all available tools with information about the server they belong to.\n\nExample response:\n{\n \"tools\": [\n {\n \"name\": \"create_zap\",\n \"description\": \"Create a new zap\",\n \"inputSchema\": \"tool_input_schema\",\n \"mcp_info\": {\n \"server_name\": \"zapier\",\n \"logo_url\": \"https://www.zapier.com/logo.png\",\n }\n }\n ],\n \"error\": null,\n \"message\": \"Successfully retrieved tools\"\n}", + "description": "List all available tools with information about the server they belong to.\n\nExample response:\n{\n \"tools\": [\n {\n \"name\": \"create_zap\",\n \"description\": \"Create a new zap\",\n \"inputSchema\": \"tool_input_schema\",\n \"mcp_info\": {\n \"server_name\": \"zapier\",\n \"logo_url\": \"https://www.zapier.com/logo.png\",\n \"server_id\": \"a1b2c3d4-...\",\n \"alias\": \"zapier_prod\",\n }\n }\n ],\n \"error\": null,\n \"message\": \"Successfully retrieved tools\"\n}", "operationId": "list_tool_rest_api_mcp_rest_tools_list_get_2", "parameters": [ { @@ -14528,6 +15877,54 @@ "description": "The server id to list tools for", "title": "Server Id" } + }, + { + "description": "Filter tools to a single MCP server by name or alias", + "in": "query", + "name": "mcp_server_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Filter tools to a single MCP server by name or alias", + "title": "Mcp Server Name" + } + }, + { + "description": "Filter tools to a single toolset by name", + "in": "query", + "name": "toolset_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Filter tools to a single toolset by name", + "title": "Toolset Name" + } + }, + { + "description": "Admin only. Return the full server tool catalog without the allowed_tools filter or per-key tool permissions, so the MCP settings UI can configure the allowlist. Ignored for non-admins.", + "in": "query", + "name": "include_disabled_tools", + "required": false, + "schema": { + "default": false, + "description": "Admin only. Return the full server tool catalog without the allowed_tools filter or per-key tool permissions, so the MCP settings UI can configure the allowlist. Ignored for non-admins.", + "title": "Include Disabled Tools", + "type": "boolean" + } } ], "responses": { @@ -14569,13 +15966,635 @@ }, "mcp_byok_oauth": { "components": { - "schemas": {} + "schemas": { + "HTTPValidationError": { + "properties": { + "detail": { + "items": { + "$ref": "#/components/schemas/ValidationError" + }, + "title": "Detail", + "type": "array" + } + }, + "title": "HTTPValidationError", + "type": "object" + }, + "ValidationError": { + "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "title": "Location", + "type": "array" + }, + "msg": { + "title": "Message", + "type": "string" + }, + "type": { + "title": "Error Type", + "type": "string" + } + }, + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError", + "type": "object" + } + } }, - "paths": {} + "paths": { + "/.well-known/oauth-authorization-server": { + "get": { + "description": "OAuth authorization server discovery endpoint.\n\nSupports both legacy pattern (/{server_name}) and root endpoint.", + "operationId": "oauth_authorization_server_mcp__well_known_oauth_authorization_server_get", + "parameters": [ + { + "in": "query", + "name": "mcp_server_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Authorization Server Mcp", + "tags": [ + "mcp_byok_oauth" + ] + } + }, + "/.well-known/oauth-authorization-server/mcp": { + "get": { + "description": "OAuth authorization server discovery for the aggregate /mcp endpoint, the RFC 8414\npath-inserted form for a client that treats {base}/mcp as its authorization base URL.\n\nThe single-segment /mcp is reserved for the aggregate so the discovery chain stays\nconsistent: the aggregate protected-resource document advertises {base}/mcp as its\nauthorization server, so the document served here must have issuer {base}/mcp. A server\nliterally named ``mcp`` therefore does not take this route; it keeps its standard\ntwo-segment discovery at /.well-known/oauth-authorization-server/mcp/mcp. Letting the\nper-server row win here instead would serve an issuer of {base} against a resource that\nadvertised {base}/mcp, which fails the RFC 8414 issuer check and breaks the front door.", + "operationId": "oauth_authorization_server_aggregate__well_known_oauth_authorization_server_mcp_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Oauth Authorization Server Aggregate", + "tags": [ + "mcp_byok_oauth" + ] + } + }, + "/.well-known/oauth-authorization-server/mcp/{mcp_server_name}": { + "get": { + "description": "OAuth authorization server discovery endpoint using standard MCP URL pattern.\n\nStandard pattern: /mcp/{server_name}\nDiscovery path: /.well-known/oauth-authorization-server/mcp/{server_name}", + "operationId": "oauth_authorization_server_mcp_standard__well_known_oauth_authorization_server_mcp__mcp_server_name__get", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "title": "Mcp Server Name", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Authorization Server Mcp Standard", + "tags": [ + "mcp_byok_oauth" + ] + } + }, + "/.well-known/oauth-authorization-server/{mcp_server_name}": { + "get": { + "description": "OAuth authorization server discovery endpoint.\n\nSupports both legacy pattern (/{server_name}) and root endpoint.", + "operationId": "oauth_authorization_server_mcp__well_known_oauth_authorization_server__mcp_server_name__get", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Authorization Server Mcp", + "tags": [ + "mcp_byok_oauth" + ] + } + }, + "/.well-known/oauth-authorization-server/{mcp_server_name}/mcp": { + "get": { + "description": "OAuth authorization server discovery for legacy /{server_name}/mcp pattern.", + "operationId": "oauth_authorization_server_legacy__well_known_oauth_authorization_server__mcp_server_name__mcp_get", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "title": "Mcp Server Name", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Authorization Server Legacy", + "tags": [ + "mcp_byok_oauth" + ] + } + }, + "/.well-known/oauth-protected-resource": { + "get": { + "description": "OAuth protected resource discovery endpoint using LiteLLM legacy URL pattern.\n\nLegacy pattern: /{server_name}/mcp\nDiscovery path: /.well-known/oauth-protected-resource/{server_name}/mcp\n\nThis endpoint is kept for backward compatibility. New integrations should\nuse the standard MCP pattern (/mcp/{server_name}) instead.", + "operationId": "oauth_protected_resource_mcp__well_known_oauth_protected_resource_get", + "parameters": [ + { + "in": "query", + "name": "mcp_server_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Protected Resource Mcp", + "tags": [ + "mcp_byok_oauth" + ] + } + }, + "/.well-known/oauth-protected-resource/mcp": { + "get": { + "description": "OAuth protected resource discovery for the aggregate /mcp endpoint.\n\nThe single-segment ``/mcp`` path does not collide with any per-server PRM pattern\n(those are two-segment: ``/mcp/{server}`` or ``/{server}/mcp``), so this unambiguously\ndescribes the aggregate resource.", + "operationId": "oauth_protected_resource_aggregate__well_known_oauth_protected_resource_mcp_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Oauth Protected Resource Aggregate", + "tags": [ + "mcp_byok_oauth" + ] + } + }, + "/.well-known/oauth-protected-resource/mcp/{mcp_server_name}": { + "get": { + "description": "OAuth protected resource discovery endpoint using standard MCP URL pattern.\n\nStandard pattern: /mcp/{server_name}\nDiscovery path: /.well-known/oauth-protected-resource/mcp/{server_name}\n\nThis endpoint is compliant with MCP specification and works with standard\nMCP clients like mcp-inspector and VSCode Copilot.", + "operationId": "oauth_protected_resource_mcp_standard__well_known_oauth_protected_resource_mcp__mcp_server_name__get", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "title": "Mcp Server Name", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Protected Resource Mcp Standard", + "tags": [ + "mcp_byok_oauth" + ] + } + }, + "/.well-known/oauth-protected-resource/{mcp_server_name}/mcp": { + "get": { + "description": "OAuth protected resource discovery endpoint using LiteLLM legacy URL pattern.\n\nLegacy pattern: /{server_name}/mcp\nDiscovery path: /.well-known/oauth-protected-resource/{server_name}/mcp\n\nThis endpoint is kept for backward compatibility. New integrations should\nuse the standard MCP pattern (/mcp/{server_name}) instead.", + "operationId": "oauth_protected_resource_mcp__well_known_oauth_protected_resource__mcp_server_name__mcp_get", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Protected Resource Mcp", + "tags": [ + "mcp_byok_oauth" + ] + } + } + } }, "mcp_discoverable": { "components": { "schemas": { + "Body_authorize_complete_authorize_complete_post": { + "properties": { + "decision": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Decision" + }, + "delivery": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Delivery" + }, + "flow": { + "title": "Flow", + "type": "string" + }, + "team_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Team Id" + } + }, + "required": [ + "flow" + ], + "title": "Body_authorize_complete_authorize_complete_post", + "type": "object" + }, + "Body_revoke_endpoint_revoke_post": { + "properties": { + "client_id": { + "title": "Client Id", + "type": "string" + }, + "token": { + "title": "Token", + "type": "string" + } + }, + "required": [ + "token", + "client_id" + ], + "title": "Body_revoke_endpoint_revoke_post", + "type": "object" + }, + "Body_token_endpoint__mcp_server_name__token_post": { + "properties": { + "client_id": { + "title": "Client Id", + "type": "string" + }, + "client_secret": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Secret" + }, + "code": { + "title": "Code", + "type": "string" + }, + "code_verifier": { + "title": "Code Verifier", + "type": "string" + }, + "grant_type": { + "title": "Grant Type", + "type": "string" + }, + "redirect_uri": { + "title": "Redirect Uri", + "type": "string" + }, + "refresh_token": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Refresh Token" + }, + "resource": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Resource" + }, + "scope": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Scope" + } + }, + "required": [ + "grant_type", + "client_id" + ], + "title": "Body_token_endpoint__mcp_server_name__token_post", + "type": "object" + }, + "Body_token_endpoint_token_post": { + "properties": { + "client_id": { + "title": "Client Id", + "type": "string" + }, + "client_secret": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Secret" + }, + "code": { + "title": "Code", + "type": "string" + }, + "code_verifier": { + "title": "Code Verifier", + "type": "string" + }, + "grant_type": { + "title": "Grant Type", + "type": "string" + }, + "redirect_uri": { + "title": "Redirect Uri", + "type": "string" + }, + "refresh_token": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Refresh Token" + }, + "resource": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Resource" + }, + "scope": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Scope" + } + }, + "required": [ + "grant_type", + "client_id" + ], + "title": "Body_token_endpoint_token_post", + "type": "object" + }, "CallbacksByType": { "properties": { "failure": { @@ -14607,67 +16626,7 @@ ], "title": "CallbacksByType", "type": "object" - } - } - }, - "paths": { - "/callbacks/configs": { - "get": { - "description": "Get Available Callback Configurations\n\nReturns the configuration details for all available logging callbacks,\nincluding supported parameters, field types, and descriptions.", - "operationId": "get_callback_configs_callbacks_configs_get", - "responses": { - "200": { - "content": { - "application/json": { - "schema": {} - } - }, - "description": "Successful Response" - } - }, - "security": [ - { - "APIKeyHeader": [] - } - ], - "summary": "Get Callback Configs", - "tags": [ - "mcp_discoverable" - ] - } - }, - "/callbacks/list": { - "get": { - "description": "View List of Active Logging Callbacks", - "operationId": "list_callbacks_callbacks_list_get", - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CallbacksByType" - } - } - }, - "description": "Successful Response" - } - }, - "security": [ - { - "APIKeyHeader": [] - } - ], - "summary": "List Callbacks", - "tags": [ - "mcp_discoverable" - ] - } - } - } - }, - "mcp_management": { - "components": { - "schemas": { + }, "HTTPValidationError": { "properties": { "detail": { @@ -14727,6 +16686,17 @@ "title": "Args", "type": "array" }, + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, "auth_type": { "anyOf": [ { @@ -14738,7 +16708,11 @@ "authorization", "oauth2", "aws_sigv4", - "token" + "token", + "oauth2_token_exchange", + "oauth2_id_jag", + "true_passthrough", + "oauth_delegate" ], "type": "string" }, @@ -14793,6 +16767,17 @@ ], "title": "Command" }, + "connected_app_reachable": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Connected App Reachable" + }, "created_at": { "anyOf": [ { @@ -14826,6 +16811,22 @@ } ] }, + "dcr_bridge": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Dcr Bridge" + }, + "delegate_auth_to_upstream": { + "default": false, + "title": "Delegate Auth To Upstream", + "type": "boolean" + }, "description": { "anyOf": [ { @@ -14844,6 +16845,20 @@ "title": "Env", "type": "object" }, + "env_vars": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/MCPEnvVar" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Env Vars" + }, "extra_headers": { "items": { "type": "string" @@ -14889,6 +16904,17 @@ "title": "Is Byok", "type": "boolean" }, + "issuer": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Issuer" + }, "last_health_check": { "anyOf": [ { @@ -14901,6 +16927,17 @@ ], "title": "Last Health Check" }, + "max_concurrent_requests": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Max Concurrent Requests" + }, "mcp_access_groups": { "items": { "type": "string" @@ -14920,6 +16957,26 @@ ], "title": "Mcp Info" }, + "oauth2_flow": { + "anyOf": [ + { + "enum": [ + "client_credentials", + "authorization_code" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Oauth2 Flow" + }, + "oauth_passthrough": { + "default": false, + "title": "Oauth Passthrough", + "type": "boolean" + }, "registration_url": { "anyOf": [ { @@ -15023,6 +17080,17 @@ "description": "Health status: 'healthy', 'unhealthy', 'unknown'", "title": "Status" }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, "submitted_at": { "anyOf": [ { @@ -15063,6 +17131,39 @@ "title": "Teams", "type": "array" }, + "timeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Timeout" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, "token_url": { "anyOf": [ { @@ -15155,6 +17256,17 @@ }, "MCPCredentials": { "properties": { + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, "auth_value": { "anyOf": [ { @@ -15243,6 +17355,17 @@ ], "title": "Aws Session Token" }, + "client_assertion_signing_alg": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Assertion Signing Alg" + }, "client_id": { "anyOf": [ { @@ -15254,6 +17377,28 @@ ], "title": "Client Id" }, + "client_private_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Private Key" + }, + "client_private_key_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Private Key Id" + }, "client_secret": { "anyOf": [ { @@ -15265,6 +17410,42 @@ ], "title": "Client Secret" }, + "id_jag_resource": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id Jag Resource" + }, + "id_jag_resource_token_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id Jag Resource Token Endpoint" + }, + "redirect_uris": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Redirect Uris" + }, "scopes": { "anyOf": [ { @@ -15278,11 +17459,2947 @@ } ], "title": "Scopes" + }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, + "token_endpoint_auth_method": { + "anyOf": [ + { + "enum": [ + "client_secret_basic", + "client_secret_post" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Endpoint Auth Method" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, + "upstream_resource": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Upstream Resource" } }, "title": "MCPCredentials", "type": "object" }, + "MCPEnvVar": { + "description": "One environment variable for an MCP server.\n\nVariables can be interpolated into ``static_headers`` using ``${NAME}``\nsyntax. ``scope=global`` values are stored on the server. ``scope=user``\nvalues are stored per-user in ``LiteLLM_MCPUserEnvVars`` and supplied by\neach user.", + "properties": { + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + }, + "name": { + "title": "Name", + "type": "string" + }, + "scope": { + "$ref": "#/components/schemas/MCPEnvVarScope", + "default": "global" + }, + "value": { + "default": "", + "title": "Value", + "type": "string" + } + }, + "required": [ + "name" + ], + "title": "MCPEnvVar", + "type": "object" + }, + "MCPEnvVarScope": { + "description": "Scope for an MCP server environment variable.\n\n- ``global``: value is provided by the admin and used for all users.\n- ``user``: each user must provide their own value via the per-user\n env-var endpoint. The admin-supplied ``value`` is treated as a\n placeholder/hint and is not used at request time.", + "enum": [ + "global", + "user" + ], + "title": "MCPEnvVarScope", + "type": "string" + }, + "NewMCPServerRequest": { + "properties": { + "alias": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Alias" + }, + "allow_all_keys": { + "default": false, + "title": "Allow All Keys", + "type": "boolean" + }, + "allowed_tools": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Allowed Tools" + }, + "approval_status": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Server-managed: set by the endpoint; caller values are overridden.", + "title": "Approval Status" + }, + "args": { + "items": { + "type": "string" + }, + "title": "Args", + "type": "array" + }, + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, + "auth_type": { + "anyOf": [ + { + "enum": [ + "none", + "api_key", + "bearer_token", + "basic", + "authorization", + "oauth2", + "aws_sigv4", + "token", + "oauth2_token_exchange", + "oauth2_id_jag", + "true_passthrough", + "oauth_delegate" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Auth Type" + }, + "authorization_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization Url" + }, + "available_on_public_internet": { + "default": true, + "title": "Available On Public Internet", + "type": "boolean" + }, + "byok_api_key_help_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Byok Api Key Help Url" + }, + "byok_description": { + "items": { + "type": "string" + }, + "title": "Byok Description", + "type": "array" + }, + "command": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Command" + }, + "credentials": { + "anyOf": [ + { + "$ref": "#/components/schemas/MCPCredentials" + }, + { + "type": "null" + } + ] + }, + "dcr_bridge": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Dcr Bridge" + }, + "delegate_auth_to_upstream": { + "default": false, + "title": "Delegate Auth To Upstream", + "type": "boolean" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + }, + "env": { + "additionalProperties": { + "type": "string" + }, + "title": "Env", + "type": "object" + }, + "env_vars": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/MCPEnvVar" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Env Vars" + }, + "extra_headers": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Extra Headers" + }, + "instructions": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Instructions" + }, + "is_byok": { + "default": false, + "title": "Is Byok", + "type": "boolean" + }, + "issuer": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Issuer" + }, + "max_concurrent_requests": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Max Concurrent Requests" + }, + "mcp_access_groups": { + "items": { + "type": "string" + }, + "title": "Mcp Access Groups", + "type": "array" + }, + "mcp_info": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Mcp Info" + }, + "oauth2_flow": { + "anyOf": [ + { + "enum": [ + "client_credentials", + "authorization_code" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Oauth2 Flow" + }, + "oauth_passthrough": { + "default": false, + "title": "Oauth Passthrough", + "type": "boolean" + }, + "registration_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Registration Url" + }, + "server_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Server Id" + }, + "server_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Server Name" + }, + "source_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Source Url" + }, + "spec_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Spec Path" + }, + "static_headers": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Static Headers" + }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, + "submitted_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Server-managed: set by the endpoint; caller values are overridden.", + "title": "Submitted At" + }, + "submitted_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Server-managed: set by the endpoint; caller values are overridden.", + "title": "Submitted By" + }, + "timeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Timeout" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, + "token_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Url" + }, + "tool_name_to_description": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Tool Name To Description" + }, + "tool_name_to_display_name": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Tool Name To Display Name" + }, + "transport": { + "default": "sse", + "enum": [ + "sse", + "http", + "stdio" + ], + "title": "Transport", + "type": "string" + }, + "url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Url" + } + }, + "title": "NewMCPServerRequest", + "type": "object" + }, + "RegisterGuardrailRequest": { + "description": "Request body for POST /guardrails/register. Follows Generic Guardrail API config.", + "properties": { + "guardrail_info": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Guardrail Info" + }, + "guardrail_name": { + "title": "Guardrail Name", + "type": "string" + }, + "litellm_params": { + "additionalProperties": true, + "title": "Litellm Params", + "type": "object" + }, + "team_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Team Id" + } + }, + "required": [ + "guardrail_name", + "litellm_params" + ], + "title": "RegisterGuardrailRequest", + "type": "object" + }, + "RegisterGuardrailResponse": { + "properties": { + "guardrail_id": { + "title": "Guardrail Id", + "type": "string" + }, + "guardrail_name": { + "title": "Guardrail Name", + "type": "string" + }, + "status": { + "title": "Status", + "type": "string" + }, + "submitted_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Submitted At" + } + }, + "required": [ + "guardrail_id", + "guardrail_name", + "status" + ], + "title": "RegisterGuardrailResponse", + "type": "object" + }, + "ValidationError": { + "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "title": "Location", + "type": "array" + }, + "msg": { + "title": "Message", + "type": "string" + }, + "type": { + "title": "Error Type", + "type": "string" + } + }, + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError", + "type": "object" + } + } + }, + "paths": { + "/.well-known/jwks.json": { + "get": { + "description": "JSON Web Key Set endpoint.\n\nReturns the RSA public key used by MCPJWTSigner to sign outbound MCP tokens.\nMCP servers and gateways use this endpoint to verify liteLLM-issued JWTs.\n\nReturns an empty key set if MCPJWTSigner is not configured.", + "operationId": "jwks_json__well_known_jwks_json_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Jwks Json", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/litellm-cli-auth": { + "get": { + "description": "The versioned contract a native client (``lite login --pkce``, or a CLI in any other\nlanguage) reads to sign a user in through the browser and obtain a proxy credential.", + "operationId": "native_client_auth_discovery__well_known_litellm_cli_auth_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Native Client Auth Discovery", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/oauth-authorization-server": { + "get": { + "description": "OAuth authorization server discovery endpoint.\n\nSupports both legacy pattern (/{server_name}) and root endpoint.", + "operationId": "oauth_authorization_server_mcp__well_known_oauth_authorization_server_get_2", + "parameters": [ + { + "in": "query", + "name": "mcp_server_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Authorization Server Mcp", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/oauth-authorization-server/mcp": { + "get": { + "description": "OAuth authorization server discovery for the aggregate /mcp endpoint, the RFC 8414\npath-inserted form for a client that treats {base}/mcp as its authorization base URL.\n\nThe single-segment /mcp is reserved for the aggregate so the discovery chain stays\nconsistent: the aggregate protected-resource document advertises {base}/mcp as its\nauthorization server, so the document served here must have issuer {base}/mcp. A server\nliterally named ``mcp`` therefore does not take this route; it keeps its standard\ntwo-segment discovery at /.well-known/oauth-authorization-server/mcp/mcp. Letting the\nper-server row win here instead would serve an issuer of {base} against a resource that\nadvertised {base}/mcp, which fails the RFC 8414 issuer check and breaks the front door.", + "operationId": "oauth_authorization_server_aggregate__well_known_oauth_authorization_server_mcp_get_2", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Oauth Authorization Server Aggregate", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/oauth-authorization-server/mcp/{mcp_server_name}": { + "get": { + "description": "OAuth authorization server discovery endpoint using standard MCP URL pattern.\n\nStandard pattern: /mcp/{server_name}\nDiscovery path: /.well-known/oauth-authorization-server/mcp/{server_name}", + "operationId": "oauth_authorization_server_mcp_standard__well_known_oauth_authorization_server_mcp__mcp_server_name__get_2", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "title": "Mcp Server Name", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Authorization Server Mcp Standard", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/oauth-authorization-server/{mcp_server_name}": { + "get": { + "description": "OAuth authorization server discovery endpoint.\n\nSupports both legacy pattern (/{server_name}) and root endpoint.", + "operationId": "oauth_authorization_server_mcp__well_known_oauth_authorization_server__mcp_server_name__get_2", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Authorization Server Mcp", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/oauth-authorization-server/{mcp_server_name}/mcp": { + "get": { + "description": "OAuth authorization server discovery for legacy /{server_name}/mcp pattern.", + "operationId": "oauth_authorization_server_legacy__well_known_oauth_authorization_server__mcp_server_name__mcp_get_2", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "title": "Mcp Server Name", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Authorization Server Legacy", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/oauth-protected-resource": { + "get": { + "description": "OAuth protected resource discovery endpoint using LiteLLM legacy URL pattern.\n\nLegacy pattern: /{server_name}/mcp\nDiscovery path: /.well-known/oauth-protected-resource/{server_name}/mcp\n\nThis endpoint is kept for backward compatibility. New integrations should\nuse the standard MCP pattern (/mcp/{server_name}) instead.", + "operationId": "oauth_protected_resource_mcp__well_known_oauth_protected_resource_get_2", + "parameters": [ + { + "in": "query", + "name": "mcp_server_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Protected Resource Mcp", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/oauth-protected-resource/mcp": { + "get": { + "description": "OAuth protected resource discovery for the aggregate /mcp endpoint.\n\nThe single-segment ``/mcp`` path does not collide with any per-server PRM pattern\n(those are two-segment: ``/mcp/{server}`` or ``/{server}/mcp``), so this unambiguously\ndescribes the aggregate resource.", + "operationId": "oauth_protected_resource_aggregate__well_known_oauth_protected_resource_mcp_get_2", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Oauth Protected Resource Aggregate", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/oauth-protected-resource/mcp/{mcp_server_name}": { + "get": { + "description": "OAuth protected resource discovery endpoint using standard MCP URL pattern.\n\nStandard pattern: /mcp/{server_name}\nDiscovery path: /.well-known/oauth-protected-resource/mcp/{server_name}\n\nThis endpoint is compliant with MCP specification and works with standard\nMCP clients like mcp-inspector and VSCode Copilot.", + "operationId": "oauth_protected_resource_mcp_standard__well_known_oauth_protected_resource_mcp__mcp_server_name__get_2", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "title": "Mcp Server Name", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Protected Resource Mcp Standard", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/oauth-protected-resource/{mcp_server_name}/mcp": { + "get": { + "description": "OAuth protected resource discovery endpoint using LiteLLM legacy URL pattern.\n\nLegacy pattern: /{server_name}/mcp\nDiscovery path: /.well-known/oauth-protected-resource/{server_name}/mcp\n\nThis endpoint is kept for backward compatibility. New integrations should\nuse the standard MCP pattern (/mcp/{server_name}) instead.", + "operationId": "oauth_protected_resource_mcp__well_known_oauth_protected_resource__mcp_server_name__mcp_get_2", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Oauth Protected Resource Mcp", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/.well-known/openid-configuration": { + "get": { + "operationId": "openid_configuration__well_known_openid_configuration_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "summary": "Openid Configuration", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/authorize": { + "get": { + "operationId": "authorize_authorize_get", + "parameters": [ + { + "in": "query", + "name": "redirect_uri", + "required": true, + "schema": { + "title": "Redirect Uri", + "type": "string" + } + }, + { + "in": "query", + "name": "client_id", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Id" + } + }, + { + "in": "query", + "name": "state", + "required": false, + "schema": { + "default": "", + "title": "State", + "type": "string" + } + }, + { + "in": "query", + "name": "mcp_server_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + }, + { + "in": "query", + "name": "code_challenge", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Code Challenge" + } + }, + { + "in": "query", + "name": "code_challenge_method", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Code Challenge Method" + } + }, + { + "in": "query", + "name": "response_type", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Response Type" + } + }, + { + "in": "query", + "name": "scope", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Scope" + } + }, + { + "in": "query", + "name": "resource", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Resource" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Authorize", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/authorize/complete": { + "post": { + "description": "Finish an aggregate connect flow: mint the gateway authorization code for the\nsigned-in user and hand it back to the DCR client, by 303 redirect (default) or, for\na loopback client on a different machine, as a copyable callback URL\n(``delivery=manual``). POST plus the per-flow HttpOnly cookie set at /authorize; an\nanonymous or bad-flow request just 400s. The native-client consent page adds\n``decision`` (approve or deny) and the ``team_id`` the credential is attributed to.", + "operationId": "authorize_complete_authorize_complete_post", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/Body_authorize_complete_authorize_complete_post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Authorize Complete", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/callback": { + "get": { + "description": "OAuth 2.0 authorization response handler for MCP loopback clients.\n\nAccepts either:\n\n- A successful authorization response (``code`` + ``state``), which is\n forwarded back to the validated client ``redirect_uri`` with the\n original (un-wrapped) ``state``.\n- An error response (``error``[+``error_description``/``error_uri``]), per\n RFC 6749 \u00a74.1.2.1. When ``state`` is present and decodes to a trusted\n ``redirect_uri``, the error params are propagated back to the client so\n its OAuth library can surface them. Otherwise we render an HTML error\n page so the user is not left on an opaque 422 / blank screen.", + "operationId": "callback_callback_get", + "parameters": [ + { + "in": "query", + "name": "code", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Code" + } + }, + { + "in": "query", + "name": "state", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "State" + } + }, + { + "in": "query", + "name": "error", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Error" + } + }, + { + "in": "query", + "name": "error_description", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Error Description" + } + }, + { + "in": "query", + "name": "error_uri", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Error Uri" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Callback", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/callbacks/configs": { + "get": { + "description": "Get Available Callback Configurations\n\nReturns the configuration details for all available logging callbacks,\nincluding supported parameters, field types, and descriptions.", + "operationId": "get_callback_configs_callbacks_configs_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Get Callback Configs", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/callbacks/list": { + "get": { + "description": "View List of Active Logging Callbacks", + "operationId": "list_callbacks_callbacks_list_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CallbacksByType" + } + } + }, + "description": "Successful Response" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "List Callbacks", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/guardrails/register": { + "post": { + "description": "Register a guardrail for onboarding (team submission).\n\nAccepts a guardrail config in the\n[Generic Guardrail API](https://docs.litellm.ai/docs/adding_provider/generic_guardrail_api) format.\nThe submission is stored with status `pending_review` until an admin approves it.", + "operationId": "register_guardrail_guardrails_register_post_2", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegisterGuardrailRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegisterGuardrailResponse" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Register Guardrail", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/register": { + "post": { + "operationId": "register_client_register_post", + "parameters": [ + { + "in": "query", + "name": "mcp_server_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Register Client", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/revoke": { + "post": { + "description": "RFC 7009 revocation for the gateway's refresh tokens (``lite logout``): 200 for a known\nclient whatever the token's state, 503 when the shared single-use record cannot be written;\naccess tokens expire on their own.", + "operationId": "revoke_endpoint_revoke_post", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/Body_revoke_endpoint_revoke_post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Revoke Endpoint", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/token": { + "post": { + "description": "Accept the authorization code from client and exchange it for OAuth token.\nSupports PKCE flow by forwarding code_verifier to upstream provider.\n\n1. Call the token endpoint with PKCE parameters\n2. Store the user's token in the db - and generate a LiteLLM virtual key\n3. Return the token\n4. Return a virtual key in this response", + "operationId": "token_endpoint_token_post", + "parameters": [ + { + "in": "query", + "name": "mcp_server_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/Body_token_endpoint_token_post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Token Endpoint", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/v1/mcp/server/register": { + "post": { + "description": "Submit a new MCP server for admin review (non-admin users). Mirrors POST /guardrails/register.", + "operationId": "register_mcp_server_v1_mcp_server_register_post_2", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewMCPServerRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LiteLLM_MCPServerTable" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Register Mcp Server", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/{mcp_server_name}/authorize": { + "get": { + "operationId": "authorize__mcp_server_name__authorize_get", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + }, + { + "in": "query", + "name": "redirect_uri", + "required": true, + "schema": { + "title": "Redirect Uri", + "type": "string" + } + }, + { + "in": "query", + "name": "client_id", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Id" + } + }, + { + "in": "query", + "name": "state", + "required": false, + "schema": { + "default": "", + "title": "State", + "type": "string" + } + }, + { + "in": "query", + "name": "code_challenge", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Code Challenge" + } + }, + { + "in": "query", + "name": "code_challenge_method", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Code Challenge Method" + } + }, + { + "in": "query", + "name": "response_type", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Response Type" + } + }, + { + "in": "query", + "name": "scope", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Scope" + } + }, + { + "in": "query", + "name": "resource", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Resource" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Authorize", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/{mcp_server_name}/register": { + "post": { + "operationId": "register_client__mcp_server_name__register_post", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Register Client", + "tags": [ + "mcp_discoverable" + ] + } + }, + "/{mcp_server_name}/token": { + "post": { + "description": "Accept the authorization code from client and exchange it for OAuth token.\nSupports PKCE flow by forwarding code_verifier to upstream provider.\n\n1. Call the token endpoint with PKCE parameters\n2. Store the user's token in the db - and generate a LiteLLM virtual key\n3. Return the token\n4. Return a virtual key in this response", + "operationId": "token_endpoint__mcp_server_name__token_post", + "parameters": [ + { + "in": "path", + "name": "mcp_server_name", + "required": true, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Mcp Server Name" + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/Body_token_endpoint__mcp_server_name__token_post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": {} + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Token Endpoint", + "tags": [ + "mcp_discoverable" + ] + } + } + } + }, + "mcp_management": { + "components": { + "schemas": { + "HTTPValidationError": { + "properties": { + "detail": { + "items": { + "$ref": "#/components/schemas/ValidationError" + }, + "title": "Detail", + "type": "array" + } + }, + "title": "HTTPValidationError", + "type": "object" + }, + "LiteLLM_MCPServerTable": { + "description": "Represents a LiteLLM_MCPServerTable record", + "properties": { + "alias": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Alias" + }, + "allow_all_keys": { + "default": false, + "title": "Allow All Keys", + "type": "boolean" + }, + "allowed_tools": { + "items": { + "type": "string" + }, + "title": "Allowed Tools", + "type": "array" + }, + "approval_status": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": "active", + "description": "Approval status: 'pending_review', 'active', 'rejected'", + "title": "Approval Status" + }, + "args": { + "items": { + "type": "string" + }, + "title": "Args", + "type": "array" + }, + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, + "auth_type": { + "anyOf": [ + { + "enum": [ + "none", + "api_key", + "bearer_token", + "basic", + "authorization", + "oauth2", + "aws_sigv4", + "token", + "oauth2_token_exchange", + "oauth2_id_jag", + "true_passthrough", + "oauth_delegate" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Auth Type" + }, + "authorization_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization Url" + }, + "available_on_public_internet": { + "default": true, + "title": "Available On Public Internet", + "type": "boolean" + }, + "byok_api_key_help_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Byok Api Key Help Url" + }, + "byok_description": { + "items": { + "type": "string" + }, + "title": "Byok Description", + "type": "array" + }, + "command": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Command" + }, + "connected_app_reachable": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Connected App Reachable" + }, + "created_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Created At" + }, + "created_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Created By" + }, + "credentials": { + "anyOf": [ + { + "$ref": "#/components/schemas/MCPCredentials" + }, + { + "type": "null" + } + ] + }, + "dcr_bridge": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Dcr Bridge" + }, + "delegate_auth_to_upstream": { + "default": false, + "title": "Delegate Auth To Upstream", + "type": "boolean" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + }, + "env": { + "additionalProperties": { + "type": "string" + }, + "title": "Env", + "type": "object" + }, + "env_vars": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/MCPEnvVar" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Env Vars" + }, + "extra_headers": { + "items": { + "type": "string" + }, + "title": "Extra Headers", + "type": "array" + }, + "has_user_credential": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Has User Credential" + }, + "health_check_error": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Health Check Error" + }, + "instructions": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Instructions" + }, + "is_byok": { + "default": false, + "title": "Is Byok", + "type": "boolean" + }, + "issuer": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Issuer" + }, + "last_health_check": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Last Health Check" + }, + "max_concurrent_requests": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Max Concurrent Requests" + }, + "mcp_access_groups": { + "items": { + "type": "string" + }, + "title": "Mcp Access Groups", + "type": "array" + }, + "mcp_info": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Mcp Info" + }, + "oauth2_flow": { + "anyOf": [ + { + "enum": [ + "client_credentials", + "authorization_code" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Oauth2 Flow" + }, + "oauth_passthrough": { + "default": false, + "title": "Oauth Passthrough", + "type": "boolean" + }, + "registration_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Registration Url" + }, + "review_notes": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Review Notes" + }, + "reviewed_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Reviewed At" + }, + "server_id": { + "title": "Server Id", + "type": "string" + }, + "server_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Server Name" + }, + "source_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Source Url" + }, + "spec_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Spec Path" + }, + "static_headers": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Static Headers" + }, + "status": { + "anyOf": [ + { + "enum": [ + "healthy", + "unhealthy", + "unknown" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "unknown", + "description": "Health status: 'healthy', 'unhealthy', 'unknown'", + "title": "Status" + }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, + "submitted_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Submitted At" + }, + "submitted_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Submitted By" + }, + "teams": { + "items": { + "additionalProperties": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": "object" + }, + "title": "Teams", + "type": "array" + }, + "timeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Timeout" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, + "token_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Url" + }, + "tool_name_to_description": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Tool Name To Description" + }, + "tool_name_to_display_name": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Tool Name To Display Name" + }, + "transport": { + "enum": [ + "sse", + "http", + "stdio" + ], + "title": "Transport", + "type": "string" + }, + "updated_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Updated At" + }, + "updated_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Updated By" + }, + "url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Url" + } + }, + "required": [ + "server_id", + "transport" + ], + "title": "LiteLLM_MCPServerTable", + "type": "object" + }, + "MCPCredentials": { + "properties": { + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, + "auth_value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Auth Value" + }, + "aws_access_key_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Aws Access Key Id" + }, + "aws_region_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Aws Region Name" + }, + "aws_role_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Aws Role Name" + }, + "aws_secret_access_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Aws Secret Access Key" + }, + "aws_service_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Aws Service Name" + }, + "aws_session_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Aws Session Name" + }, + "aws_session_token": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Aws Session Token" + }, + "client_assertion_signing_alg": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Assertion Signing Alg" + }, + "client_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Id" + }, + "client_private_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Private Key" + }, + "client_private_key_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Private Key Id" + }, + "client_secret": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Secret" + }, + "id_jag_resource": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id Jag Resource" + }, + "id_jag_resource_token_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id Jag Resource Token Endpoint" + }, + "redirect_uris": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Redirect Uris" + }, + "scopes": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Scopes" + }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, + "token_endpoint_auth_method": { + "anyOf": [ + { + "enum": [ + "client_secret_basic", + "client_secret_post" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Endpoint Auth Method" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, + "upstream_resource": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Upstream Resource" + } + }, + "title": "MCPCredentials", + "type": "object" + }, + "MCPEnvVar": { + "description": "One environment variable for an MCP server.\n\nVariables can be interpolated into ``static_headers`` using ``${NAME}``\nsyntax. ``scope=global`` values are stored on the server. ``scope=user``\nvalues are stored per-user in ``LiteLLM_MCPUserEnvVars`` and supplied by\neach user.", + "properties": { + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + }, + "name": { + "title": "Name", + "type": "string" + }, + "scope": { + "$ref": "#/components/schemas/MCPEnvVarScope", + "default": "global" + }, + "value": { + "default": "", + "title": "Value", + "type": "string" + } + }, + "required": [ + "name" + ], + "title": "MCPEnvVar", + "type": "object" + }, + "MCPEnvVarScope": { + "description": "Scope for an MCP server environment variable.\n\n- ``global``: value is provided by the admin and used for all users.\n- ``user``: each user must provide their own value via the per-user\n env-var endpoint. The admin-supplied ``value`` is treated as a\n placeholder/hint and is not used at request time.", + "enum": [ + "global", + "user" + ], + "title": "MCPEnvVarScope", + "type": "string" + }, "MCPOAuthUserCredentialRequest": { "description": "Stores a user's OAuth2 token for an OpenAPI MCP server.", "properties": { @@ -15537,6 +20654,112 @@ "title": "MCPUserCredentialResponse", "type": "object" }, + "MCPUserEnvVarSpec": { + "description": "Describes one per-user env var slot for the calling user.\n\nStored values are write-only: the status only reports whether a value\n``is_set`` and never echoes the decrypted secret back to the client.", + "properties": { + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + }, + "is_set": { + "default": false, + "title": "Is Set", + "type": "boolean" + }, + "name": { + "title": "Name", + "type": "string" + } + }, + "required": [ + "name" + ], + "title": "MCPUserEnvVarSpec", + "type": "object" + }, + "MCPUserEnvVarsRequest": { + "description": "Payload for storing the calling user's per-user env var values.", + "properties": { + "values": { + "additionalProperties": { + "type": "string" + }, + "title": "Values", + "type": "object" + } + }, + "required": [ + "values" + ], + "title": "MCPUserEnvVarsRequest", + "type": "object" + }, + "MCPUserEnvVarsStatus": { + "description": "Per-user env var status for a single MCP server.", + "properties": { + "alias": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Alias" + }, + "missing_count": { + "default": 0, + "title": "Missing Count", + "type": "integer" + }, + "required": { + "items": { + "$ref": "#/components/schemas/MCPUserEnvVarSpec" + }, + "title": "Required", + "type": "array" + }, + "server_id": { + "title": "Server Id", + "type": "string" + }, + "server_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Server Name" + }, + "setup_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Setup Url" + } + }, + "required": [ + "server_id" + ], + "title": "MCPUserEnvVarsStatus", + "type": "object" + }, "MakeMCPServersPublicRequest": { "properties": { "mcp_server_ids": { @@ -15604,6 +20827,17 @@ "title": "Args", "type": "array" }, + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, "auth_type": { "anyOf": [ { @@ -15615,7 +20849,11 @@ "authorization", "oauth2", "aws_sigv4", - "token" + "token", + "oauth2_token_exchange", + "oauth2_id_jag", + "true_passthrough", + "oauth_delegate" ], "type": "string" }, @@ -15680,6 +20918,22 @@ } ] }, + "dcr_bridge": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Dcr Bridge" + }, + "delegate_auth_to_upstream": { + "default": false, + "title": "Delegate Auth To Upstream", + "type": "boolean" + }, "description": { "anyOf": [ { @@ -15698,6 +20952,20 @@ "title": "Env", "type": "object" }, + "env_vars": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/MCPEnvVar" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Env Vars" + }, "extra_headers": { "anyOf": [ { @@ -15728,6 +20996,28 @@ "title": "Is Byok", "type": "boolean" }, + "issuer": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Issuer" + }, + "max_concurrent_requests": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Max Concurrent Requests" + }, "mcp_access_groups": { "items": { "type": "string" @@ -15762,6 +21052,11 @@ ], "title": "Oauth2 Flow" }, + "oauth_passthrough": { + "default": false, + "title": "Oauth Passthrough", + "type": "boolean" + }, "registration_url": { "anyOf": [ { @@ -15831,6 +21126,17 @@ ], "title": "Static Headers" }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, "submitted_at": { "anyOf": [ { @@ -15856,6 +21162,39 @@ "description": "Server-managed: set by the endpoint; caller values are overridden.", "title": "Submitted By" }, + "timeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Timeout" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, "token_url": { "anyOf": [ { @@ -16008,6 +21347,17 @@ "title": "Args", "type": "array" }, + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, "auth_type": { "anyOf": [ { @@ -16019,7 +21369,11 @@ "authorization", "oauth2", "aws_sigv4", - "token" + "token", + "oauth2_token_exchange", + "oauth2_id_jag", + "true_passthrough", + "oauth_delegate" ], "type": "string" }, @@ -16084,6 +21438,22 @@ } ] }, + "dcr_bridge": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Dcr Bridge" + }, + "delegate_auth_to_upstream": { + "default": false, + "title": "Delegate Auth To Upstream", + "type": "boolean" + }, "description": { "anyOf": [ { @@ -16102,6 +21472,20 @@ "title": "Env", "type": "object" }, + "env_vars": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/MCPEnvVar" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Env Vars" + }, "extra_headers": { "anyOf": [ { @@ -16132,6 +21516,28 @@ "title": "Is Byok", "type": "boolean" }, + "issuer": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Issuer" + }, + "max_concurrent_requests": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Max Concurrent Requests" + }, "mcp_access_groups": { "items": { "type": "string" @@ -16151,6 +21557,26 @@ ], "title": "Mcp Info" }, + "oauth2_flow": { + "anyOf": [ + { + "enum": [ + "client_credentials", + "authorization_code" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Oauth2 Flow" + }, + "oauth_passthrough": { + "default": false, + "title": "Oauth Passthrough", + "type": "boolean" + }, "registration_url": { "anyOf": [ { @@ -16213,6 +21639,50 @@ ], "title": "Static Headers" }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, + "timeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Timeout" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, "token_url": { "anyOf": [ { @@ -16331,6 +21801,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -16600,6 +22077,18 @@ "description": "Filter MCP servers by team scope. When provided, returns only servers the team has access to plus globally available (allow_all_keys) servers. Used by the Create Key UI to show team-scoped MCP servers.", "title": "Team Id" } + }, + { + "description": "Annotate each returned server with connected_app_reachable: whether a connected app authorized by the calling user (a gateway OAuth session) is served this server on the aggregate MCP endpoint.", + "in": "query", + "name": "connected_app_view", + "required": false, + "schema": { + "default": false, + "description": "Annotate each returned server with connected_app_reachable: whether a connected app authorized by the calling user (a gateway OAuth session) is served this server on the aggregate MCP endpoint.", + "title": "Connected App View", + "type": "boolean" + } } ], "responses": { @@ -17438,6 +22927,156 @@ ] } }, + "/v1/mcp/server/{server_id}/user-env-vars": { + "delete": { + "description": "Clear the calling user's per-user MCP env var values for this server.", + "operationId": "clear_mcp_user_env_vars_v1_mcp_server__server_id__user_env_vars_delete", + "parameters": [ + { + "in": "path", + "name": "server_id", + "required": true, + "schema": { + "title": "Server Id", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MCPUserEnvVarsStatus" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Clear Mcp User Env Vars", + "tags": [ + "mcp_management" + ] + }, + "get": { + "description": "Return the calling user's per-user MCP env var status for this server.", + "operationId": "get_mcp_user_env_vars_v1_mcp_server__server_id__user_env_vars_get", + "parameters": [ + { + "in": "path", + "name": "server_id", + "required": true, + "schema": { + "title": "Server Id", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MCPUserEnvVarsStatus" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Get Mcp User Env Vars", + "tags": [ + "mcp_management" + ] + }, + "post": { + "description": "Store the calling user's per-user MCP env var values for this server. Submitted values are merged over any previously stored values, so you only send the fields you want to set or change; a variable omitted (or sent empty) keeps its stored value. Use DELETE to clear all stored values.", + "operationId": "store_mcp_user_env_vars_v1_mcp_server__server_id__user_env_vars_post", + "parameters": [ + { + "in": "path", + "name": "server_id", + "required": true, + "schema": { + "title": "Server Id", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MCPUserEnvVarsRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MCPUserEnvVarsStatus" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Store Mcp User Env Vars", + "tags": [ + "mcp_management" + ] + } + }, "/v1/mcp/tools": { "get": { "description": "Get all MCP tools available for the current key, including those from access groups", @@ -17746,6 +23385,37 @@ "mcp_management" ] } + }, + "/v1/mcp/user-env-vars/status": { + "get": { + "description": "Per-user MCP env var status across every server the user can access. Used by the dashboard to highlight servers with missing per-user vars.", + "operationId": "list_mcp_user_env_var_status_v1_mcp_user_env_vars_status_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/MCPUserEnvVarsStatus" + }, + "title": "Response List Mcp User Env Var Status V1 Mcp User Env Vars Status Get", + "type": "array" + } + } + }, + "description": "Successful Response" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "List Mcp User Env Var Status", + "tags": [ + "mcp_management" + ] + } } } }, @@ -17767,6 +23437,17 @@ }, "MCPCredentials": { "properties": { + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, "auth_value": { "anyOf": [ { @@ -17855,6 +23536,17 @@ ], "title": "Aws Session Token" }, + "client_assertion_signing_alg": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Assertion Signing Alg" + }, "client_id": { "anyOf": [ { @@ -17866,6 +23558,28 @@ ], "title": "Client Id" }, + "client_private_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Private Key" + }, + "client_private_key_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Client Private Key Id" + }, "client_secret": { "anyOf": [ { @@ -17877,6 +23591,42 @@ ], "title": "Client Secret" }, + "id_jag_resource": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id Jag Resource" + }, + "id_jag_resource_token_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id Jag Resource Token Endpoint" + }, + "redirect_uris": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Redirect Uris" + }, "scopes": { "anyOf": [ { @@ -17890,11 +23640,113 @@ } ], "title": "Scopes" + }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, + "token_endpoint_auth_method": { + "anyOf": [ + { + "enum": [ + "client_secret_basic", + "client_secret_post" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Endpoint Auth Method" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, + "upstream_resource": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Upstream Resource" } }, "title": "MCPCredentials", "type": "object" }, + "MCPEnvVar": { + "description": "One environment variable for an MCP server.\n\nVariables can be interpolated into ``static_headers`` using ``${NAME}``\nsyntax. ``scope=global`` values are stored on the server. ``scope=user``\nvalues are stored per-user in ``LiteLLM_MCPUserEnvVars`` and supplied by\neach user.", + "properties": { + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + }, + "name": { + "title": "Name", + "type": "string" + }, + "scope": { + "$ref": "#/components/schemas/MCPEnvVarScope", + "default": "global" + }, + "value": { + "default": "", + "title": "Value", + "type": "string" + } + }, + "required": [ + "name" + ], + "title": "MCPEnvVar", + "type": "object" + }, + "MCPEnvVarScope": { + "description": "Scope for an MCP server environment variable.\n\n- ``global``: value is provided by the admin and used for all users.\n- ``user``: each user must provide their own value via the per-user\n env-var endpoint. The admin-supplied ``value`` is treated as a\n placeholder/hint and is not used at request time.", + "enum": [ + "global", + "user" + ], + "title": "MCPEnvVarScope", + "type": "string" + }, "NewMCPServerRequest": { "properties": { "alias": { @@ -17946,6 +23798,17 @@ "title": "Args", "type": "array" }, + "audience": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Audience" + }, "auth_type": { "anyOf": [ { @@ -17957,7 +23820,11 @@ "authorization", "oauth2", "aws_sigv4", - "token" + "token", + "oauth2_token_exchange", + "oauth2_id_jag", + "true_passthrough", + "oauth_delegate" ], "type": "string" }, @@ -18022,6 +23889,22 @@ } ] }, + "dcr_bridge": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Dcr Bridge" + }, + "delegate_auth_to_upstream": { + "default": false, + "title": "Delegate Auth To Upstream", + "type": "boolean" + }, "description": { "anyOf": [ { @@ -18040,6 +23923,20 @@ "title": "Env", "type": "object" }, + "env_vars": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/MCPEnvVar" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Env Vars" + }, "extra_headers": { "anyOf": [ { @@ -18070,6 +23967,28 @@ "title": "Is Byok", "type": "boolean" }, + "issuer": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Issuer" + }, + "max_concurrent_requests": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Max Concurrent Requests" + }, "mcp_access_groups": { "items": { "type": "string" @@ -18104,6 +24023,11 @@ ], "title": "Oauth2 Flow" }, + "oauth_passthrough": { + "default": false, + "title": "Oauth Passthrough", + "type": "boolean" + }, "registration_url": { "anyOf": [ { @@ -18173,6 +24097,17 @@ ], "title": "Static Headers" }, + "subject_token_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Subject Token Type" + }, "submitted_at": { "anyOf": [ { @@ -18198,6 +24133,39 @@ "description": "Server-managed: set by the endpoint; caller values are overridden.", "title": "Submitted By" }, + "timeout": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Timeout" + }, + "token_exchange_endpoint": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Endpoint" + }, + "token_exchange_profile": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Token Exchange Profile" + }, "token_url": { "anyOf": [ { @@ -18264,6 +24232,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -18415,7 +24390,7 @@ }, "/mcp-rest/tools/list": { "get": { - "description": "List all available tools with information about the server they belong to.\n\nExample response:\n{\n \"tools\": [\n {\n \"name\": \"create_zap\",\n \"description\": \"Create a new zap\",\n \"inputSchema\": \"tool_input_schema\",\n \"mcp_info\": {\n \"server_name\": \"zapier\",\n \"logo_url\": \"https://www.zapier.com/logo.png\",\n }\n }\n ],\n \"error\": null,\n \"message\": \"Successfully retrieved tools\"\n}", + "description": "List all available tools with information about the server they belong to.\n\nExample response:\n{\n \"tools\": [\n {\n \"name\": \"create_zap\",\n \"description\": \"Create a new zap\",\n \"inputSchema\": \"tool_input_schema\",\n \"mcp_info\": {\n \"server_name\": \"zapier\",\n \"logo_url\": \"https://www.zapier.com/logo.png\",\n \"server_id\": \"a1b2c3d4-...\",\n \"alias\": \"zapier_prod\",\n }\n }\n ],\n \"error\": null,\n \"message\": \"Successfully retrieved tools\"\n}", "operationId": "list_tool_rest_api_mcp_rest_tools_list_get", "parameters": [ { @@ -18435,6 +24410,54 @@ "description": "The server id to list tools for", "title": "Server Id" } + }, + { + "description": "Filter tools to a single MCP server by name or alias", + "in": "query", + "name": "mcp_server_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Filter tools to a single MCP server by name or alias", + "title": "Mcp Server Name" + } + }, + { + "description": "Filter tools to a single toolset by name", + "in": "query", + "name": "toolset_name", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Filter tools to a single toolset by name", + "title": "Toolset Name" + } + }, + { + "description": "Admin only. Return the full server tool catalog without the allowed_tools filter or per-key tool permissions, so the MCP settings UI can configure the allowlist. Ignored for non-admins.", + "in": "query", + "name": "include_disabled_tools", + "required": false, + "schema": { + "default": false, + "description": "Admin only. Return the full server tool catalog without the allowed_tools filter or per-key tool permissions, so the MCP settings UI can configure the allowlist. Ignored for non-admins.", + "title": "Include Disabled Tools", + "type": "boolean" + } } ], "responses": { @@ -18655,6 +24678,14 @@ }, "ChatCompletionCachedContent": { "properties": { + "ttl": { + "enum": [ + "5m", + "1h" + ], + "title": "Ttl", + "type": "string" + }, "type": { "const": "ephemeral", "title": "Type", @@ -19053,8 +25084,15 @@ "title": "Cache Control" }, "signature": { - "title": "Signature", - "type": "string" + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Signature" }, "thinking": { "title": "Thinking", @@ -19149,7 +25187,14 @@ }, { "items": { - "$ref": "#/components/schemas/ChatCompletionTextObject" + "anyOf": [ + { + "$ref": "#/components/schemas/ChatCompletionTextObject" + }, + { + "$ref": "#/components/schemas/ChatCompletionImageObject" + } + ] }, "type": "array" } @@ -19176,6 +25221,13 @@ }, "ChatCompletionToolParam": { "properties": { + "allowed_callers": { + "items": { + "type": "string" + }, + "title": "Allowed Callers", + "type": "array" + }, "cache_control": { "$ref": "#/components/schemas/ChatCompletionCachedContent" }, @@ -19437,6 +25489,13 @@ ], "title": "Model" }, + "stream_holdback_chars": { + "items": { + "type": "integer" + }, + "title": "Stream Holdback Chars", + "type": "array" + }, "structured_messages": { "items": { "anyOf": [ @@ -20096,6 +26155,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -22046,7 +28112,7 @@ }, "/policies/list": { "get": { - "description": "List all policies from the database and config.yaml. Optionally filter by version_status.\n\nConfig-defined policies are returned with definition_location \"config\" and are treated\nas production versions. On a name conflict with a DB policy, only the DB policy is returned.\n\nQuery params:\n- version_status: Optional. One of \"draft\", \"published\", \"production\".\n If omitted, all versions are returned.\n\nExample Request:\n```bash\ncurl -X GET \"http://localhost:4000/policies/list\" \\\n -H \"Authorization: Bearer \"\ncurl -X GET \"http://localhost:4000/policies/list?version_status=production\" \\\n -H \"Authorization: Bearer \"\n```\n\nExample Response:\n```json\n{\n \"policies\": [\n {\n \"policy_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"policy_name\": \"global-baseline\",\n \"version_number\": 1,\n \"version_status\": \"production\",\n \"inherit\": null,\n \"description\": \"Base guardrails for all requests\",\n \"guardrails_add\": [\"pii_masking\"],\n \"guardrails_remove\": [],\n \"condition\": null,\n \"created_at\": \"2024-01-01T00:00:00Z\",\n \"updated_at\": \"2024-01-01T00:00:00Z\"\n }\n ],\n \"total_count\": 1\n}\n```", + "description": "List all policies from the database and config.yaml. Optionally filter by version_status.\n\nConfig-defined policies are returned with definition_location \"config\" and are treated\nas production versions. On a name conflict with a production DB policy, only the DB policy\nis returned, mirroring runtime resolution where only production DB versions override config.\nA draft or published DB version does not hide the config policy, since the config version\nis still the one being enforced.\n\nQuery params:\n- version_status: Optional. One of \"draft\", \"published\", \"production\".\n If omitted, all versions are returned.\n\nExample Request:\n```bash\ncurl -X GET \"http://localhost:4000/policies/list\" \\\n -H \"Authorization: Bearer \"\ncurl -X GET \"http://localhost:4000/policies/list?version_status=production\" \\\n -H \"Authorization: Bearer \"\n```\n\nExample Response:\n```json\n{\n \"policies\": [\n {\n \"policy_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"policy_name\": \"global-baseline\",\n \"version_number\": 1,\n \"version_status\": \"production\",\n \"inherit\": null,\n \"description\": \"Base guardrails for all requests\",\n \"guardrails_add\": [\"pii_masking\"],\n \"guardrails_remove\": [],\n \"condition\": null,\n \"created_at\": \"2024-01-01T00:00:00Z\",\n \"updated_at\": \"2024-01-01T00:00:00Z\"\n }\n ],\n \"total_count\": 1\n}\n```", "operationId": "list_policies_policies_list_get", "parameters": [ { @@ -22946,6 +29012,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -23096,7 +29169,7 @@ "Body_convert_prompt_file_to_json_utils_dotprompt_json_converter_post": { "properties": { "file": { - "format": "binary", + "contentMediaType": "application/octet-stream", "title": "File", "type": "string" } @@ -23502,6 +29575,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -24147,6 +30227,26 @@ ], "title": "RealtimeClientSecretResponse", "type": "object" + }, + "RealtimeTranscriptionSessionResponse": { + "additionalProperties": true, + "description": "Response from POST /v1/realtime/transcription_sessions.\n\n`client_secret.value` contains the encrypted token instead of the raw\nephemeral key. Unknown fields pass through unchanged.", + "properties": { + "client_secret": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Client Secret" + } + }, + "title": "RealtimeTranscriptionSessionResponse", + "type": "object" } } }, @@ -24196,6 +30296,33 @@ ] } }, + "/openai/v1/realtime/transcription_sessions": { + "post": { + "description": "Create an ephemeral Realtime transcription session\n(POST /v1/realtime/transcription_sessions) for the WebRTC/WebSocket flow.\n\nMirrors the client_secrets route but targets the transcription_sessions\nendpoint and encrypts the ephemeral key returned under `client_secret.value`.", + "operationId": "create_realtime_transcription_session_openai_v1_realtime_transcription_sessions_post", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionResponse" + } + } + }, + "description": "Successful Response" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Create Realtime Transcription Session", + "tags": [ + "realtime" + ] + } + }, "/realtime/calls": { "post": { "operationId": "proxy_realtime_calls_realtime_calls_post", @@ -24241,6 +30368,33 @@ ] } }, + "/realtime/transcription_sessions": { + "post": { + "description": "Create an ephemeral Realtime transcription session\n(POST /v1/realtime/transcription_sessions) for the WebRTC/WebSocket flow.\n\nMirrors the client_secrets route but targets the transcription_sessions\nendpoint and encrypts the ephemeral key returned under `client_secret.value`.", + "operationId": "create_realtime_transcription_session_realtime_transcription_sessions_post", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionResponse" + } + } + }, + "description": "Successful Response" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Create Realtime Transcription Session", + "tags": [ + "realtime" + ] + } + }, "/v1/realtime/calls": { "post": { "operationId": "proxy_realtime_calls_v1_realtime_calls_post", @@ -24285,6 +30439,33 @@ "realtime" ] } + }, + "/v1/realtime/transcription_sessions": { + "post": { + "description": "Create an ephemeral Realtime transcription session\n(POST /v1/realtime/transcription_sessions) for the WebRTC/WebSocket flow.\n\nMirrors the client_secrets route but targets the transcription_sessions\nendpoint and encrypts the ephemeral key returned under `client_secret.value`.", + "operationId": "create_realtime_transcription_session_v1_realtime_transcription_sessions_post", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RealtimeTranscriptionSessionResponse" + } + } + }, + "description": "Successful Response" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Create Realtime Transcription Session", + "tags": [ + "realtime" + ] + } } } }, @@ -24304,6 +30485,77 @@ "title": "HTTPValidationError", "type": "object" }, + "SCIMEnterpriseUser": { + "properties": { + "costCenter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Costcenter" + }, + "department": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Department" + }, + "division": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Division" + }, + "employeeNumber": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Employeenumber" + }, + "manager": { + "anyOf": [ + { + "$ref": "#/components/schemas/SCIMUserManager" + }, + { + "type": "null" + } + ] + }, + "organization": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Organization" + } + }, + "title": "SCIMEnterpriseUser", + "type": "object" + }, "SCIMFeature": { "properties": { "maxOperations": { @@ -24425,7 +30677,7 @@ "anyOf": [ { "items": { - "$ref": "#/components/schemas/SCIMUser" + "$ref": "#/components/schemas/SCIMUser-Output" }, "type": "array" }, @@ -24497,6 +30749,17 @@ ], "title": "Display" }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Type" + }, "value": { "title": "Value", "type": "string" @@ -24508,6 +30771,52 @@ "title": "SCIMMember", "type": "object" }, + "SCIMMultiValuedAttribute": { + "properties": { + "display": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Display" + }, + "primary": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Primary" + }, + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Type" + }, + "value": { + "title": "Value", + "type": "string" + } + }, + "required": [ + "value" + ], + "title": "SCIMMultiValuedAttribute", + "type": "object" + }, "SCIMPatchOp": { "properties": { "Operations": { @@ -24646,7 +30955,7 @@ "title": "SCIMServiceProviderConfig", "type": "object" }, - "SCIMUser": { + "SCIMUser-Input": { "properties": { "active": { "default": true, @@ -24678,6 +30987,20 @@ ], "title": "Emails" }, + "entitlements": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/SCIMMultiValuedAttribute" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Entitlements" + }, "externalId": { "anyOf": [ { @@ -24736,6 +31059,20 @@ } ] }, + "roles": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/SCIMMultiValuedAttribute" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Roles" + }, "schemas": { "items": { "type": "string" @@ -24743,6 +31080,16 @@ "title": "Schemas", "type": "array" }, + "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { + "anyOf": [ + { + "$ref": "#/components/schemas/SCIMEnterpriseUser" + }, + { + "type": "null" + } + ] + }, "userName": { "anyOf": [ { @@ -24761,6 +31108,10 @@ "title": "SCIMUser", "type": "object" }, + "SCIMUser-Output": { + "additionalProperties": true, + "type": "object" + }, "SCIMUserEmail": { "properties": { "primary": { @@ -24833,6 +31184,45 @@ "title": "SCIMUserGroup", "type": "object" }, + "SCIMUserManager": { + "properties": { + "$ref": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "$Ref" + }, + "displayName": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Displayname" + }, + "value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Value" + } + }, + "title": "SCIMUserManager", + "type": "object" + }, "SCIMUserName": { "properties": { "familyName": { @@ -24907,6 +31297,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -25817,7 +32214,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SCIMUser" + "$ref": "#/components/schemas/SCIMUser-Input" } } }, @@ -25828,7 +32225,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SCIMUser" + "$ref": "#/components/schemas/SCIMUser-Output" } } }, @@ -25947,7 +32344,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SCIMUser" + "$ref": "#/components/schemas/SCIMUser-Output" } } }, @@ -26019,7 +32416,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SCIMUser" + "$ref": "#/components/schemas/SCIMUser-Output" } } }, @@ -26080,7 +32477,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SCIMUser" + "$ref": "#/components/schemas/SCIMUser-Input" } } }, @@ -26091,7 +32488,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SCIMUser" + "$ref": "#/components/schemas/SCIMUser-Output" } } }, @@ -26387,6 +32784,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -28290,6 +34694,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -28389,6 +34800,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -28937,6 +35355,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -30490,16 +36915,7 @@ }, "required": [ "vector_store_id", - "custom_llm_provider", - "vector_store_name", - "vector_store_description", - "vector_store_metadata", - "created_at", - "updated_at", - "litellm_credential_name", - "litellm_params", - "team_id", - "user_id" + "custom_llm_provider" ], "title": "LiteLLM_ManagedVectorStoresTable", "type": "object" @@ -30515,6 +36931,13 @@ }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -30998,8 +37421,118 @@ "title": "IndexCreateRequest", "type": "object" }, + "IndexListResponse": { + "properties": { + "data": { + "items": { + "$ref": "#/components/schemas/LiteLLM_ManagedVectorStoreIndex" + }, + "title": "Data", + "type": "array" + }, + "object": { + "const": "list", + "default": "list", + "title": "Object", + "type": "string" + } + }, + "required": [ + "data" + ], + "title": "IndexListResponse", + "type": "object" + }, + "LiteLLM_ManagedVectorStoreIndex": { + "description": "LiteLLM managed vector store index object - this is is the object stored in the database", + "properties": { + "created_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Created At" + }, + "created_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Created By" + }, + "id": { + "title": "Id", + "type": "string" + }, + "index_info": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Index Info" + }, + "index_name": { + "title": "Index Name", + "type": "string" + }, + "litellm_params": { + "$ref": "#/components/schemas/IndexCreateLiteLLMParams" + }, + "updated_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Updated At" + }, + "updated_by": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Updated By" + } + }, + "required": [ + "id", + "index_name", + "litellm_params" + ], + "title": "LiteLLM_ManagedVectorStoreIndex", + "type": "object" + }, "ValidationError": { "properties": { + "ctx": { + "title": "Context", + "type": "object" + }, + "input": { + "title": "Input" + }, "loc": { "items": { "anyOf": [ @@ -31035,8 +37568,33 @@ }, "paths": { "/v1/indexes": { + "get": { + "description": "List all vector store indexes. Proxy admin only.\n\n```bash\ncurl -L -X GET 'http://0.0.0.0:4000/v1/indexes' -H 'Authorization: Bearer sk-1234'\n```", + "operationId": "index_list_v1_indexes_get", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IndexListResponse" + } + } + }, + "description": "Successful Response" + } + }, + "security": [ + { + "APIKeyHeader": [] + } + ], + "summary": "Index List", + "tags": [ + "vector_stores" + ] + }, "post": { - "description": "Create an index. Just writes the index to the database.\n\n```bash\ncurl -L -X POST 'http://0.0.0.0:4000/indexes/create' -H 'Content-Type: application/json' -H 'Authorization: Bearer sk-1234' -H 'LiteLLM-Beta: indexes_beta=v1' -d '{ \n \"index_name\": \"dall-e-3\",\n \"vector_store_index\": \"real-index-name\",\n \"vector_store_name\": \"azure-ai-search\"\n }'\n```", + "description": "Create an index. Just writes the index to the database.\n\n```bash\ncurl -L -X POST 'http://0.0.0.0:4000/v1/indexes' -H 'Content-Type: application/json' -H 'Authorization: Bearer sk-1234' -d '{\n \"index_name\": \"dall-e-3\",\n \"litellm_params\": {\n \"vector_store_index\": \"real-index-name\",\n \"vector_store_name\": \"azure-ai-search\"\n }\n }'\n```", "operationId": "index_create_v1_indexes_post", "requestBody": { "content": { diff --git a/litellm/proxy/_lazy_openapi_snapshot.py b/litellm/proxy/_lazy_openapi_snapshot.py index 41359d44b27..a895a0809b1 100644 --- a/litellm/proxy/_lazy_openapi_snapshot.py +++ b/litellm/proxy/_lazy_openapi_snapshot.py @@ -3,18 +3,25 @@ Per-feature OpenAPI snapshot for lazy-loaded routers. The committed JSON is generated by `python -m litellm.proxy._lazy_openapi_snapshot` and consumed at runtime so /openapi.json can show full route info for unloaded -features without importing them. No CI job regenerates this file; drift surfaces -only indirectly through check-ui-api-types.yml, which rebuilds schema.d.ts from -app.openapi() with the committed snapshot injected. After changing any lazily -loaded route or this generator, rerun the module and commit the JSON, then run -`npm run gen:api` in ui/litellm-dashboard and commit schema.d.ts. +features without importing them. check-ui-api-types.yml (mirrored locally by +`make check`) regenerates this file and fails when the committed copy differs, +then rebuilds schema.d.ts from app.openapi() with the snapshot injected. After +changing any lazily loaded route or this generator, rerun the module and commit +the JSON, then run `npm run gen:api` in ui/litellm-dashboard and commit schema.d.ts. """ import json import re import sys +from collections.abc import Callable +from dataclasses import dataclass from pathlib import Path -from typing import Final +from typing import TYPE_CHECKING, Final + +if TYPE_CHECKING: + from fastapi import FastAPI + + from litellm.proxy._lazy_features import LazyFeature SNAPSHOT_FILE: Final = Path(__file__).parent / "_lazy_openapi_snapshot.json" HTTP_METHOD_SUFFIXES: Final = { @@ -83,20 +90,30 @@ def _normalize_operation_ids(paths: dict[str, dict]) -> None: break -def generate_snapshot() -> dict[str, dict]: +@dataclass(frozen=True, slots=True) +class SnapshotResult: + fragments: dict[str, dict] + skipped: tuple[str, ...] + + +def _register_feature(app: "FastAPI", feat: "LazyFeature") -> str | None: import importlib + try: + feat.register_fn(app, importlib.import_module(feat.module_path)) + except Exception as exc: + sys.stderr.write(f"warning: skip {feat.name}: {exc}\n") + return feat.name + return None + + +def generate_snapshot() -> SnapshotResult: from fastapi.openapi.utils import get_openapi from litellm.proxy._lazy_features import LAZY_FEATURES from litellm.proxy.proxy_server import app, ensure_unique_openapi_operation_ids - for feat in LAZY_FEATURES: - try: - module = importlib.import_module(feat.module_path) - feat.register_fn(app, module) - except Exception as exc: - sys.stderr.write(f"warning: skip {feat.name}: {exc}\n") + skipped: Final = tuple(name for feat in LAZY_FEATURES if (name := _register_feature(app, feat)) is not None) fragments: Final[dict[str, dict]] = {} used_operation_ids: Final[set[str]] = set() @@ -124,10 +141,21 @@ def generate_snapshot() -> dict[str, dict]: "paths": paths, "components": {"schemas": full.get("components", {}).get("schemas", {})}, } - return fragments + return SnapshotResult(fragments=fragments, skipped=skipped) + + +def main(snapshot_file: Path = SNAPSHOT_FILE, generate: Callable[[], SnapshotResult] = generate_snapshot) -> int: + result: Final = generate() + if result.skipped: + sys.stderr.write( + f"error: {len(result.skipped)} feature(s) failed to import, so their fragments would vanish from the " + f"snapshot: {', '.join(result.skipped)}\n" + ) + return 1 + snapshot_file.write_text(json.dumps(result.fragments, indent=2, sort_keys=True) + "\n") + sys.stdout.write(f"wrote {len(result.fragments)} feature fragments to {snapshot_file}\n") + return 0 if __name__ == "__main__": - fragments: Final = generate_snapshot() - SNAPSHOT_FILE.write_text(json.dumps(fragments, indent=2, sort_keys=True) + "\n") - sys.stdout.write(f"wrote {len(fragments)} feature fragments to {SNAPSHOT_FILE}\n") + sys.exit(main()) diff --git a/scripts/pre_commit_lint.sh b/scripts/pre_commit_lint.sh index 0861172056e..ff553be6461 100755 --- a/scripts/pre_commit_lint.sh +++ b/scripts/pre_commit_lint.sh @@ -13,7 +13,7 @@ # - tests/e2e Python -> `make lint-e2e-basedpyright` (test-linting.yml's e2e type-check step) # + raw HTTP client ban (test-code-quality.yml's check_e2e_no_raw_requests) # - dashboard -> prettier + eslint + lint budgets (test-litellm-ui-build.yml's frontend-lint) -# - proxy/types -> regenerate dashboard API types and fail on drift (check-ui-api-types.yml) +# - proxy/types -> regenerate the lazy OpenAPI snapshot and dashboard API types, fail on drift (check-ui-api-types.yml) # # Each block is skipped when no matching files are in scope, so unrelated commits # stay fast. This is intentionally not auto-installed as a git hook (see @@ -244,7 +244,7 @@ fi genapi_checks() { local status=0 - echo "check: checking dashboard API types are in sync (npm run gen:api)" + echo "check: checking the lazy OpenAPI snapshot and dashboard API types are in sync (npm run gen:api)" # gen-api-types.mjs imports litellm.proxy.proxy_server, which needs the proxy deps # and an up-to-date Prisma client; check-ui-api-types.yml installs those and runs # prisma generate before gen:api, so mirror that here or a stale client can mask @@ -260,7 +260,14 @@ genapi_checks() { elif ! uv run --no-sync python scripts/prisma_generate_if_needed.py; then echo "✗ Could not regenerate Prisma client (prisma generate failed)." >&2 status=1 + elif ! uv run --no-sync python -m litellm.proxy._lazy_openapi_snapshot; then + echo "✗ Could not regenerate the lazy OpenAPI snapshot (python -m litellm.proxy._lazy_openapi_snapshot failed)." >&2 + status=1 elif ( cd ui/litellm-dashboard && LITELLM_PYTHON="uv run --no-sync python" npm run gen:api ); then + if ! git diff --quiet -- litellm/proxy/_lazy_openapi_snapshot.json; then + echo "✗ The lazy OpenAPI snapshot is stale; regenerated litellm/proxy/_lazy_openapi_snapshot.json. Stage it and commit; re-run make check only if other checks failed too." >&2 + status=1 + fi if ! git diff --quiet -- ui/litellm-dashboard/src/lib/http/schema.d.ts; then echo "✗ Dashboard API types are stale; regenerated src/lib/http/schema.d.ts. Stage it and commit; re-run make check only if other checks failed too." >&2 status=1 diff --git a/tests/test_litellm/proxy/test_lazy_openapi_snapshot.py b/tests/test_litellm/proxy/test_lazy_openapi_snapshot.py index 79330b0e3a6..c513bd83b66 100644 --- a/tests/test_litellm/proxy/test_lazy_openapi_snapshot.py +++ b/tests/test_litellm/proxy/test_lazy_openapi_snapshot.py @@ -1,8 +1,9 @@ +import json import sys from types import ModuleType, SimpleNamespace from litellm.proxy._lazy_features import LazyFeature -from litellm.proxy._lazy_openapi_snapshot import _normalize_operation_ids +from litellm.proxy._lazy_openapi_snapshot import SnapshotResult, _normalize_operation_ids, main def test_generate_snapshot_uses_shared_operation_id_reservations(monkeypatch): @@ -61,7 +62,7 @@ def test_generate_snapshot_uses_shared_operation_id_reservations(monkeypatch): monkeypatch.setitem(sys.modules, "litellm.proxy.proxy_server", fake_proxy_server_module) monkeypatch.setattr("fastapi.openapi.utils.get_openapi", fake_get_openapi) - fragments = _lazy_openapi_snapshot.generate_snapshot() + fragments = _lazy_openapi_snapshot.generate_snapshot().fragments assert fragments["feature-a"]["paths"]["/feature-a/items"]["get"]["operationId"] == "shared_operation_id_get" assert fragments["feature-b"]["paths"]["/feature-b/items"]["get"]["operationId"] == "shared_operation_id_get_2" @@ -106,7 +107,7 @@ def test_generate_snapshot_registers_transitively_imported_modules(monkeypatch): monkeypatch.setitem(sys.modules, "litellm.proxy.proxy_server", fake_proxy_server_module) monkeypatch.setattr("fastapi.openapi.utils.get_openapi", fake_get_openapi) - fragments = _lazy_openapi_snapshot.generate_snapshot() + fragments = _lazy_openapi_snapshot.generate_snapshot().fragments assert fragments["transitive"]["paths"]["/transitive/items"]["get"]["tags"] == ["transitive"] assert "/v1/{param}/deep/leaf" in fragments["transitive"]["paths"] @@ -144,3 +145,63 @@ def test_normalize_operation_ids_preserves_custom_ids(): operations = paths["/proxy/{endpoint}"] assert operations["get"]["operationId"] == "custom_operation" assert operations["post"]["operationId"] == "custom_operation" + + +def test_generate_snapshot_reports_features_whose_import_fails(monkeypatch): + from litellm.proxy import _lazy_openapi_snapshot + + fake_app = SimpleNamespace(title="LiteLLM test", version="0.0.0", routes=[]) + + fake_module = ModuleType("fake_importable_feature") + monkeypatch.setitem(sys.modules, "fake_importable_feature", fake_module) + + def register_fn(app, module): + app.routes.append(SimpleNamespace(path="/importable/items")) + + fake_lazy_features_module = ModuleType("litellm.proxy._lazy_features") + fake_lazy_features_module.LAZY_FEATURES = [ + LazyFeature( + name="importable", + module_path="fake_importable_feature", + path_prefixes=("/importable",), + register_fn=register_fn, + ), + LazyFeature( + name="broken", + module_path="litellm.proxy.this_module_does_not_exist", + path_prefixes=("/broken",), + ), + ] + monkeypatch.setitem(sys.modules, "litellm.proxy._lazy_features", fake_lazy_features_module) + + def fake_get_openapi(title, version, routes): + return {"paths": {route.path: {"get": {"operationId": "importable_get"}} for route in routes}} + + fake_proxy_server_module = ModuleType("litellm.proxy.proxy_server") + fake_proxy_server_module.app = fake_app + fake_proxy_server_module.ensure_unique_openapi_operation_ids = lambda schema, reserved_operation_ids: schema + monkeypatch.setitem(sys.modules, "litellm.proxy.proxy_server", fake_proxy_server_module) + monkeypatch.setattr("fastapi.openapi.utils.get_openapi", fake_get_openapi) + + result = _lazy_openapi_snapshot.generate_snapshot() + + assert result.skipped == ("broken",) + assert sorted(result.fragments) == ["importable"] + + +def test_main_refuses_to_write_a_snapshot_missing_skipped_features(tmp_path, capsys): + snapshot_file = tmp_path / "snapshot.json" + result = SnapshotResult(fragments={"importable": {"paths": {}, "components": {"schemas": {}}}}, skipped=("broken",)) + + assert main(snapshot_file, generate=lambda: result) == 1 + assert not snapshot_file.exists() + assert "broken" in capsys.readouterr().err + + +def test_main_writes_sorted_snapshot_when_every_feature_loads(tmp_path): + snapshot_file = tmp_path / "snapshot.json" + fragments = {"zeta": {"paths": {"/z": {}}, "components": {"schemas": {}}}, "alpha": {"paths": {}, "components": {"schemas": {}}}} + + assert main(snapshot_file, generate=lambda: SnapshotResult(fragments=fragments, skipped=())) == 0 + assert json.loads(snapshot_file.read_text()) == fragments + assert snapshot_file.read_text() == json.dumps(fragments, indent=2, sort_keys=True) + "\n" diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.ts index 9af332abd2f..cc496566d85 100644 --- a/ui/litellm-dashboard/src/lib/http/schema.d.ts +++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts @@ -21,6 +21,52 @@ export interface paths { patch?: never; trace?: never; }; + "/.well-known/jwks.json": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Jwks Json + * @description JSON Web Key Set endpoint. + * + * Returns the RSA public key used by MCPJWTSigner to sign outbound MCP tokens. + * MCP servers and gateways use this endpoint to verify liteLLM-issued JWTs. + * + * Returns an empty key set if MCPJWTSigner is not configured. + */ + get: operations["jwks_json__well_known_jwks_json_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/litellm-cli-auth": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Native Client Auth Discovery + * @description The versioned contract a native client (``lite login --pkce``, or a CLI in any other + * language) reads to sign a user in through the browser and obtain a proxy credential. + */ + get: operations["native_client_auth_discovery__well_known_litellm_cli_auth_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/.well-known/litellm-ui-config": { parameters: { query?: never; @@ -38,6 +84,241 @@ export interface paths { patch?: never; trace?: never; }; + "/.well-known/oauth-authorization-server": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Oauth Authorization Server Mcp + * @description OAuth authorization server discovery endpoint. + * + * Supports both legacy pattern (/{server_name}) and root endpoint. + */ + get: operations["oauth_authorization_server_mcp__well_known_oauth_authorization_server_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/oauth-authorization-server/mcp": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Oauth Authorization Server Aggregate + * @description OAuth authorization server discovery for the aggregate /mcp endpoint, the RFC 8414 + * path-inserted form for a client that treats {base}/mcp as its authorization base URL. + * + * The single-segment /mcp is reserved for the aggregate so the discovery chain stays + * consistent: the aggregate protected-resource document advertises {base}/mcp as its + * authorization server, so the document served here must have issuer {base}/mcp. A server + * literally named ``mcp`` therefore does not take this route; it keeps its standard + * two-segment discovery at /.well-known/oauth-authorization-server/mcp/mcp. Letting the + * per-server row win here instead would serve an issuer of {base} against a resource that + * advertised {base}/mcp, which fails the RFC 8414 issuer check and breaks the front door. + */ + get: operations["oauth_authorization_server_aggregate__well_known_oauth_authorization_server_mcp_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/oauth-authorization-server/mcp/{mcp_server_name}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Oauth Authorization Server Mcp Standard + * @description OAuth authorization server discovery endpoint using standard MCP URL pattern. + * + * Standard pattern: /mcp/{server_name} + * Discovery path: /.well-known/oauth-authorization-server/mcp/{server_name} + */ + get: operations["oauth_authorization_server_mcp_standard__well_known_oauth_authorization_server_mcp__mcp_server_name__get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/oauth-authorization-server/{mcp_server_name}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Oauth Authorization Server Mcp + * @description OAuth authorization server discovery endpoint. + * + * Supports both legacy pattern (/{server_name}) and root endpoint. + */ + get: operations["oauth_authorization_server_mcp__well_known_oauth_authorization_server__mcp_server_name__get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/oauth-authorization-server/{mcp_server_name}/mcp": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Oauth Authorization Server Legacy + * @description OAuth authorization server discovery for legacy /{server_name}/mcp pattern. + */ + get: operations["oauth_authorization_server_legacy__well_known_oauth_authorization_server__mcp_server_name__mcp_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/oauth-protected-resource": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Oauth Protected Resource Mcp + * @description OAuth protected resource discovery endpoint using LiteLLM legacy URL pattern. + * + * Legacy pattern: /{server_name}/mcp + * Discovery path: /.well-known/oauth-protected-resource/{server_name}/mcp + * + * This endpoint is kept for backward compatibility. New integrations should + * use the standard MCP pattern (/mcp/{server_name}) instead. + */ + get: operations["oauth_protected_resource_mcp__well_known_oauth_protected_resource_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/oauth-protected-resource/mcp": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Oauth Protected Resource Aggregate + * @description OAuth protected resource discovery for the aggregate /mcp endpoint. + * + * The single-segment ``/mcp`` path does not collide with any per-server PRM pattern + * (those are two-segment: ``/mcp/{server}`` or ``/{server}/mcp``), so this unambiguously + * describes the aggregate resource. + */ + get: operations["oauth_protected_resource_aggregate__well_known_oauth_protected_resource_mcp_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/oauth-protected-resource/mcp/{mcp_server_name}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Oauth Protected Resource Mcp Standard + * @description OAuth protected resource discovery endpoint using standard MCP URL pattern. + * + * Standard pattern: /mcp/{server_name} + * Discovery path: /.well-known/oauth-protected-resource/mcp/{server_name} + * + * This endpoint is compliant with MCP specification and works with standard + * MCP clients like mcp-inspector and VSCode Copilot. + */ + get: operations["oauth_protected_resource_mcp_standard__well_known_oauth_protected_resource_mcp__mcp_server_name__get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/oauth-protected-resource/{mcp_server_name}/mcp": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Oauth Protected Resource Mcp + * @description OAuth protected resource discovery endpoint using LiteLLM legacy URL pattern. + * + * Legacy pattern: /{server_name}/mcp + * Discovery path: /.well-known/oauth-protected-resource/{server_name}/mcp + * + * This endpoint is kept for backward compatibility. New integrations should + * use the standard MCP pattern (/mcp/{server_name}) instead. + */ + get: operations["oauth_protected_resource_mcp__well_known_oauth_protected_resource__mcp_server_name__mcp_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/openid-configuration": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Openid Configuration */ + get: operations["openid_configuration__well_known_openid_configuration_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/a2a/{agent_id}": { parameters: { query?: never; @@ -760,6 +1041,48 @@ export interface paths { patch?: never; trace?: never; }; + "/authorize": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Authorize */ + get: operations["authorize_authorize_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/authorize/complete": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Authorize Complete + * @description Finish an aggregate connect flow: mint the gateway authorization code for the + * signed-in user and hand it back to the DCR client, by 303 redirect (default) or, for + * a loopback client on a different machine, as a copyable callback URL + * (``delivery=manual``). POST plus the per-flow HttpOnly cookie set at /authorize; an + * anonymous or bad-flow request just 400s. The native-client consent page adds + * ``decision`` (approve or deny) and the ``team_id`` the credential is attributed to. + */ + post: operations["authorize_complete_authorize_complete_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/auto_router/benchmarks": { parameters: { query?: never; @@ -1535,6 +1858,37 @@ export interface paths { patch?: never; trace?: never; }; + "/callback": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Callback + * @description OAuth 2.0 authorization response handler for MCP loopback clients. + * + * Accepts either: + * + * - A successful authorization response (``code`` + ``state``), which is + * forwarded back to the validated client ``redirect_uri`` with the + * original (un-wrapped) ``state``. + * - An error response (``error``[+``error_description``/``error_uri``]), per + * RFC 6749 §4.1.2.1. When ``state`` is present and decodes to a trusted + * ``redirect_uri``, the error params are propagated back to the client so + * its OAuth library can surface them. Otherwise we render an HTML error + * page so the user is not left on an opaque 422 / blank screen. + */ + get: operations["callback_callback_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/callbacks/configs": { parameters: { query?: never; @@ -1677,6 +2031,8 @@ export interface paths { * the same name already exists it returns 409 Conflict; use * PUT /claude-code/plugins/{plugin_name} to update an existing plugin. * + * Requires a proxy admin API key. + * * Parameters: * - name: Plugin name (kebab-case) * - source: Git source reference (github, url, or git-subdir format) @@ -1741,6 +2097,8 @@ export interface paths { * Returns 404 if no plugin with the given name exists; use * POST /claude-code/plugins to create a new plugin. * + * Requires a proxy admin API key. + * * Parameters: * - plugin_name: Name of the plugin to update (path parameter) * - source: Git source reference (github, url, or git-subdir format) @@ -1772,6 +2130,8 @@ export interface paths { * Delete Plugin * @description Delete a plugin from the marketplace. * + * Requires a proxy admin API key. + * * Parameters: * - plugin_name: The name of the plugin to delete */ @@ -1794,6 +2154,8 @@ export interface paths { * Disable Plugin * @description Disable a plugin without deleting it. * + * Requires a proxy admin API key. + * * Parameters: * - plugin_name: The name of the plugin to disable */ @@ -1817,6 +2179,8 @@ export interface paths { * Enable Plugin * @description Enable a disabled plugin. * + * Requires a proxy admin API key. + * * Parameters: * - plugin_name: The name of the plugin to enable */ @@ -7886,6 +8250,8 @@ export interface paths { * "mcp_info": { * "server_name": "zapier", * "logo_url": "https://www.zapier.com/logo.png", + * "server_id": "a1b2c3d4-...", + * "alias": "zapier_prod", * } * } * ], @@ -9049,6 +9415,30 @@ export interface paths { patch?: never; trace?: never; }; + "/openai/v1/realtime/transcription_sessions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Create Realtime Transcription Session + * @description Create an ephemeral Realtime transcription session + * (POST /v1/realtime/transcription_sessions) for the WebRTC/WebSocket flow. + * + * Mirrors the client_secrets route but targets the transcription_sessions + * endpoint and encrypts the ephemeral key returned under `client_secret.value`. + */ + post: operations["create_realtime_transcription_session_openai_v1_realtime_transcription_sessions_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/openai/v1/responses": { parameters: { query?: never; @@ -10207,7 +10597,10 @@ export interface paths { * @description List all policies from the database and config.yaml. Optionally filter by version_status. * * Config-defined policies are returned with definition_location "config" and are treated - * as production versions. On a name conflict with a DB policy, only the DB policy is returned. + * as production versions. On a name conflict with a production DB policy, only the DB policy + * is returned, mirroring runtime resolution where only production DB versions override config. + * A draft or published DB version does not hide the config policy, since the config version + * is still the one being enforced. * * Query params: * - version_status: Optional. One of "draft", "published", "production". @@ -11829,6 +12222,47 @@ export interface paths { patch?: never; trace?: never; }; + "/realtime/transcription_sessions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Create Realtime Transcription Session + * @description Create an ephemeral Realtime transcription session + * (POST /v1/realtime/transcription_sessions) for the WebRTC/WebSocket flow. + * + * Mirrors the client_secrets route but targets the transcription_sessions + * endpoint and encrypts the ephemeral key returned under `client_secret.value`. + */ + post: operations["create_realtime_transcription_session_realtime_transcription_sessions_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/register": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Register Client */ + post: operations["register_client_register_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/reload/anthropic_beta_headers": { parameters: { query?: never; @@ -12068,6 +12502,28 @@ export interface paths { patch?: never; trace?: never; }; + "/revoke": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Revoke Endpoint + * @description RFC 7009 revocation for the gateway's refresh tokens (``lite logout``): 200 for a known + * client whatever the token's state, 503 when the shared single-use record cannot be written; + * access tokens expire on their own. + */ + post: operations["revoke_endpoint_revoke_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/robots.txt": { parameters: { query?: never; @@ -15116,6 +15572,32 @@ export interface paths { patch?: never; trace?: never; }; + "/token": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Token Endpoint + * @description Accept the authorization code from client and exchange it for OAuth token. + * Supports PKCE flow by forwarding code_verifier to upstream provider. + * + * 1. Call the token endpoint with PKCE parameters + * 2. Store the user's token in the db - and generate a LiteLLM virtual key + * 3. Return the token + * 4. Return a virtual key in this response + */ + post: operations["token_endpoint_token_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/toolset/{toolset_name}/mcp": { parameters: { query?: never; @@ -15976,27 +16458,25 @@ export interface paths { path?: never; cookie?: never; }; - /** a2a_registration */ - get: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; + get?: never; put?: never; - post?: never; + /** + * Discover Agent Card + * @description Fetch the upstream agent's well-known card so the UI can show the admin + * which skills/capabilities the agent exposes. + * + * Only proxy admins can call this — the UI uses it during agent registration, + * and we don't want arbitrary keys probing internal URLs. + * + * Example: + * ```bash + * curl -X POST "http://localhost:4000/v1/a2a/discover" \ + * -H "Authorization: Bearer " \ + * -H "Content-Type: application/json" \ + * -d '{"url": "https://upstream-agent.example.com"}' + * ``` + */ + post: operations["discover_agent_card_v1_a2a_discover_post"]; delete?: never; options?: never; head?: never; @@ -16096,30 +16576,30 @@ export interface paths { * -H "Content-Type: application/json" \ * -d '{ * "agent_name": "my-custom-agent", - * "agent_card_params": { - * "protocolVersion": "1.0", - * "name": "Hello World Agent", - * "description": "Just a hello world agent", - * "url": "http://localhost:9999/", - * "version": "1.0.0", - * "defaultInputModes": ["text"], - * "defaultOutputModes": ["text"], - * "capabilities": { - * "streaming": true - * }, - * "skills": [ - * { - * "id": "hello_world", - * "name": "Returns hello world", - * "description": "just returns hello world", - * "tags": ["hello world"], - * "examples": ["hi", "hello world"] - * } - * ] + * "agent_card_params": { + * "protocolVersion": "1.0", + * "name": "Hello World Agent", + * "description": "Just a hello world agent", + * "url": "http://localhost:9999/", + * "version": "1.0.0", + * "defaultInputModes": ["text"], + * "defaultOutputModes": ["text"], + * "capabilities": { + * "streaming": true * }, - * "litellm_params": { - * "make_public": true - * } + * "skills": [ + * { + * "id": "hello_world", + * "name": "Returns hello world", + * "description": "just returns hello world", + * "tags": ["hello world"], + * "examples": ["hi", "hello world"] + * } + * ] + * }, + * "litellm_params": { + * "make_public": true + * } * }' * ``` */ @@ -16189,7 +16669,7 @@ export interface paths { * * Example Request: * ```bash - * curl -X GET "http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000" \ + * curl -X GET "http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000" \ * -H "Authorization: Bearer " * ``` */ @@ -16200,28 +16680,26 @@ export interface paths { * * Example Request: * ```bash - * curl -X PUT "http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000" \ + * curl -X PUT "http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000" \ * -H "Authorization: Bearer " \ * -H "Content-Type: application/json" \ * -d '{ - * "agent": { - * "agent_name": "updated-agent", - * "agent_card_params": { - * "protocolVersion": "1.0", - * "name": "Updated Agent", - * "description": "Updated description", - * "url": "http://localhost:9999/", - * "version": "1.1.0", - * "defaultInputModes": ["text"], - * "defaultOutputModes": ["text"], - * "capabilities": { - * "streaming": true - * }, - * "skills": [] + * "agent_name": "updated-agent", + * "agent_card_params": { + * "protocolVersion": "1.0", + * "name": "Updated Agent", + * "description": "Updated description", + * "url": "http://localhost:9999/", + * "version": "1.1.0", + * "defaultInputModes": ["text"], + * "defaultOutputModes": ["text"], + * "capabilities": { + * "streaming": true * }, - * "litellm_params": { - * "make_public": false - * } + * "skills": [] + * }, + * "litellm_params": { + * "make_public": false * } * }' * ``` @@ -16234,7 +16712,7 @@ export interface paths { * * Example Request: * ```bash - * curl -X DELETE "http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000" \ + * curl -X DELETE "http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000" \ * -H "Authorization: Bearer " * ``` * @@ -16254,28 +16732,26 @@ export interface paths { * * Example Request: * ```bash - * curl -X PUT "http://localhost:4000/agents/123e4567-e89b-12d3-a456-426614174000" \ + * curl -X PATCH "http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000" \ * -H "Authorization: Bearer " \ * -H "Content-Type: application/json" \ * -d '{ - * "agent": { - * "agent_name": "updated-agent", - * "agent_card_params": { - * "protocolVersion": "1.0", - * "name": "Updated Agent", - * "description": "Updated description", - * "url": "http://localhost:9999/", - * "version": "1.1.0", - * "defaultInputModes": ["text"], - * "defaultOutputModes": ["text"], - * "capabilities": { - * "streaming": true - * }, - * "skills": [] + * "agent_name": "updated-agent", + * "agent_card_params": { + * "protocolVersion": "1.0", + * "name": "Updated Agent", + * "description": "Updated description", + * "url": "http://localhost:9999/", + * "version": "1.1.0", + * "defaultInputModes": ["text"], + * "defaultOutputModes": ["text"], + * "capabilities": { + * "streaming": true * }, - * "litellm_params": { - * "make_public": false - * } + * "skills": [] + * }, + * "litellm_params": { + * "make_public": false * } * }' * ``` @@ -17292,17 +17768,27 @@ export interface paths { path?: never; cookie?: never; }; - get?: never; + /** + * Index List + * @description List all vector store indexes. Proxy admin only. + * + * ```bash + * curl -L -X GET 'http://0.0.0.0:4000/v1/indexes' -H 'Authorization: Bearer sk-1234' + * ``` + */ + get: operations["index_list_v1_indexes_get"]; put?: never; /** * Index Create * @description Create an index. Just writes the index to the database. * * ```bash - * curl -L -X POST 'http://0.0.0.0:4000/indexes/create' -H 'Content-Type: application/json' -H 'Authorization: Bearer sk-1234' -H 'LiteLLM-Beta: indexes_beta=v1' -d '{ + * curl -L -X POST 'http://0.0.0.0:4000/v1/indexes' -H 'Content-Type: application/json' -H 'Authorization: Bearer sk-1234' -d '{ * "index_name": "dall-e-3", - * "vector_store_index": "real-index-name", - * "vector_store_name": "azure-ai-search" + * "litellm_params": { + * "vector_store_index": "real-index-name", + * "vector_store_name": "azure-ai-search" + * } * }' * ``` */ @@ -17673,6 +18159,34 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/mcp/server/{server_id}/user-env-vars": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get Mcp User Env Vars + * @description Return the calling user's per-user MCP env var status for this server. + */ + get: operations["get_mcp_user_env_vars_v1_mcp_server__server_id__user_env_vars_get"]; + put?: never; + /** + * Store Mcp User Env Vars + * @description Store the calling user's per-user MCP env var values for this server. Submitted values are merged over any previously stored values, so you only send the fields you want to set or change; a variable omitted (or sent empty) keeps its stored value. Use DELETE to clear all stored values. + */ + post: operations["store_mcp_user_env_vars_v1_mcp_server__server_id__user_env_vars_post"]; + /** + * Clear Mcp User Env Vars + * @description Clear the calling user's per-user MCP env var values for this server. + */ + delete: operations["clear_mcp_user_env_vars_v1_mcp_server__server_id__user_env_vars_delete"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/mcp/tools": { parameters: { query?: never; @@ -17765,6 +18279,26 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/mcp/user-env-vars/status": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List Mcp User Env Var Status + * @description Per-user MCP env var status across every server the user can access. Used by the dashboard to highlight servers with missing per-user vars. + */ + get: operations["list_mcp_user_env_var_status_v1_mcp_user_env_vars_status_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/memory": { parameters: { query?: never; @@ -18274,6 +18808,30 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/realtime/transcription_sessions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Create Realtime Transcription Session + * @description Create an ephemeral Realtime transcription session + * (POST /v1/realtime/transcription_sessions) for the WebRTC/WebSocket flow. + * + * Mirrors the client_secrets route but targets the transcription_sessions + * endpoint and encrypts the ephemeral key returned under `client_secret.value`. + */ + post: operations["create_realtime_transcription_session_v1_realtime_transcription_sessions_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/rerank": { parameters: { query?: never; @@ -19660,25 +20218,118 @@ export interface paths { path?: never; cookie?: never; }; - /** gemini_agents */ - get: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; + /** + * List Gemini Agents + * @description List all custom agents on the Gemini side. + * + * Pass per-request Gemini credentials via the JSON-encoded + * ``litellm_params_template`` query parameter. Flat query parameters + * (e.g. ``?api_key=AIza...``) are intentionally ignored — see + * ``_merge_query_params_into_data`` for the rationale. + * + * ```bash + * curl "http://localhost:4000/v1beta/agents?litellm_params_template=%7B%22api_key%22%3A%22AIza...%22%7D" \ + * -H "Authorization: Bearer sk-..." + * ``` + */ + get: operations["list_gemini_agents_v1beta_agents_get"]; + put?: never; + /** + * Create Gemini Agent + * @description Create a named custom agent on the Gemini side. + * + * Example: + * ```bash + * curl -X POST "http://localhost:4000/v1beta/agents" \ + * -H "Authorization: Bearer sk-..." \ + * -H "Content-Type: application/json" \ + * -d '{ + * "name": "my-custom-slides-agent", + * "base_agent": "waverunner", + * "instructions": "You are a helpful assistant that creates slides.", + * "base_environment": { + * "type": "remote", + * "sources": [ + * {"type": "gcs", "source": "gs://eap-templates/slides-skill", + * "target": "/.agents/skills/slides-skill"} + * ] + * } + * }' + * ``` + */ + post: operations["create_gemini_agent_v1beta_agents_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1beta/agents/{name}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; + /** + * Get Gemini Agent + * @description Get a specific custom agent by name. + * + * Pass per-request Gemini credentials via the JSON-encoded + * ``litellm_params_template`` query parameter. Flat query parameters + * (e.g. ``?api_key=AIza...``) are intentionally ignored — see + * ``_merge_query_params_into_data`` for the rationale. + * + * ```bash + * curl "http://localhost:4000/v1beta/agents/my-custom-slides-agent?litellm_params_template=%7B%22api_key%22%3A%22AIza...%22%7D" \ + * -H "Authorization: Bearer sk-..." + * ``` + */ + get: operations["get_gemini_agent_v1beta_agents__name__get"]; + put?: never; + post?: never; + /** + * Delete Gemini Agent + * @description Delete a custom agent by name. + * + * Pass per-request Gemini credentials via the JSON-encoded + * ``litellm_params_template`` query parameter. Flat query parameters + * (e.g. ``?api_key=AIza...``) are intentionally ignored — see + * ``_merge_query_params_into_data`` for the rationale. + * + * ```bash + * curl -X DELETE "http://localhost:4000/v1beta/agents/my-custom-slides-agent?litellm_params_template=%7B%22api_key%22%3A%22AIza...%22%7D" \ + * -H "Authorization: Bearer sk-..." + * ``` + */ + delete: operations["delete_gemini_agent_v1beta_agents__name__delete"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1beta/agents/{name}/versions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List Gemini Agent Versions + * @description List versions of a custom agent. + * + * Pass per-request Gemini credentials via the JSON-encoded + * ``litellm_params_template`` query parameter. Flat query parameters + * (e.g. ``?api_key=AIza...``) are intentionally ignored — see + * ``_merge_query_params_into_data`` for the rationale. + * + * ```bash + * curl "http://localhost:4000/v1beta/agents/my-custom-slides-agent/versions?litellm_params_template=%7B%22api_key%22%3A%22AIza...%22%7D" \ + * -H "Authorization: Bearer sk-..." + * ``` + */ + get: operations["list_gemini_agent_versions_v1beta_agents__name__versions_get"]; put?: never; post?: never; delete?: never; @@ -21059,6 +21710,23 @@ export interface paths { patch: operations["watsonx_proxy_route_watsonx__endpoint__patch"]; trace?: never; }; + "/{mcp_server_name}/authorize": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Authorize */ + get: operations["authorize__mcp_server_name__authorize_get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/{mcp_server_name}/mcp": { parameters: { query?: never; @@ -21145,6 +21813,49 @@ export interface paths { patch: operations["dynamic_mcp_route__mcp_server_name__mcp_patch"]; trace?: never; }; + "/{mcp_server_name}/register": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Register Client */ + post: operations["register_client__mcp_server_name__register_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/{mcp_server_name}/token": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Token Endpoint + * @description Accept the authorization code from client and exchange it for OAuth token. + * Supports PKCE flow by forwarding code_verifier to upstream provider. + * + * 1. Call the token endpoint with PKCE parameters + * 2. Store the user's token in the db - and generate a LiteLLM virtual key + * 3. Return the token + * 4. Return a virtual key in this response + */ + post: operations["token_endpoint__mcp_server_name__token_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/{provider}/v1/batches": { parameters: { query?: never; @@ -21678,6 +22389,15 @@ export interface components { /** Url */ url?: string; }; + /** AgentKeySummary */ + AgentKeySummary: { + /** Key Alias */ + key_alias?: string | null; + /** Key Name */ + key_name?: string | null; + /** Token */ + token: string; + }; /** AgentMakePublicResponse */ AgentMakePublicResponse: { /** Message */ @@ -21728,6 +22448,8 @@ export interface components { created_by?: string | null; /** Extra Headers */ extra_headers?: string[] | null; + /** Keys */ + keys?: components["schemas"]["AgentKeySummary"][] | null; /** Litellm Params */ litellm_params?: { [key: string]: unknown; @@ -22147,7 +22869,7 @@ export interface components { routing_decision: components["schemas"]["StandardLoggingRoutingDecision"]; }; /** BaseLitellmParams */ - "BaseLitellmParams-Input": { + BaseLitellmParams: { /** * Additional Provider Specific Params * @description Additional provider-specific parameters for generic guardrail APIs @@ -22227,7 +22949,7 @@ export interface components { extra_headers?: string[] | null; /** * Fail On Error - * @description Whether to fail the request if Model Armor encounters an error + * @description Whether to fail the request if the guardrail encounters an error. Implemented by guardrail='model_armor' and 'generic_guardrail_api'. True (default) raises the error. False logs a critical error and lets the request proceed, so only a valid guardrail response can block or modify it. * @default true */ fail_on_error: boolean | null; @@ -22261,186 +22983,22 @@ export interface components { * @description Optional field if guardrail requires a 'model' parameter */ model?: string | null; + /** + * On Sensitive Data + * @description Action to take when sensitive data is detected. 'block' raises an exception (default behavior). 'route' reroutes the request to the model specified in sensitive_data_route_to_model. + */ + on_sensitive_data?: ("block" | "route") | null; /** * On Violation * @description For /v1/realtime sessions: 'warn' speaks the violation message and continues; 'end_session' speaks the message and closes the connection. */ on_violation?: ("warn" | "end_session") | null; /** - * Pangea Input Recipe - * @description Recipe for input (LLM request) - */ - pangea_input_recipe?: string | null; - /** - * Pangea Output Recipe - * @description Recipe for output (LLM response) - */ - pangea_output_recipe?: string | null; - /** - * Pattern Redaction Format - * @description Format string for pattern redaction (use {pattern_name} placeholder) - */ - pattern_redaction_format?: string | null; - /** - * Patterns - * @description List of patterns (prebuilt or custom regex) to detect - */ - patterns?: components["schemas"]["ContentFilterPattern"][] | null; - /** - * Realtime Violation Message - * @description The message the bot speaks aloud when a /v1/realtime guardrail fires. Falls back to violation_message_template if not set. - */ - realtime_violation_message?: string | null; - /** - * Severity Threshold - * @description Minimum severity to block (high, medium, low) - */ - severity_threshold?: string | null; - /** - * Skip System Message In Guardrail - * @description When True, unified guardrails skip system-role messages when building evaluation inputs (texts and structured_messages). When False, system messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_system_message_in_guardrail setting. - */ - skip_system_message_in_guardrail?: boolean | null; - /** - * Template Id - * @description The ID of your Model Armor template - */ - template_id?: string | null; - /** - * Unreachable Fallback - * @description Behavior when a guardrail endpoint is unreachable due to network errors. NOTE: This is currently only implemented by guardrail='generic_guardrail_api'. 'fail_closed' raises an error (default). 'fail_open' logs a critical error and allows the request to proceed. - * @default fail_closed - * @enum {string} - */ - unreachable_fallback: "fail_closed" | "fail_open"; - /** - * Violation Message Template - * @description Custom message when a guardrail blocks an action. Supports placeholders like {tool_name}, {rule_id}, and {default_message}. - */ - violation_message_template?: string | null; - } & { - [key: string]: unknown; - }; - /** BaseLitellmParams */ - "BaseLitellmParams-Output": { - /** - * Additional Provider Specific Params - * @description Additional provider-specific parameters for generic guardrail APIs - */ - additional_provider_specific_params?: { - [key: string]: unknown; - } | null; - /** - * Api Base - * @description Base URL for the guardrail service API - */ - api_base?: string | null; - /** - * Api Endpoint - * @description Optional custom API endpoint for Model Armor - */ - api_endpoint?: string | null; - /** - * Api Key - * @description API key for the guardrail service - */ - api_key?: string | null; - /** - * Blocked Words - * @description List of blocked words with individual actions - */ - blocked_words?: components["schemas"]["BlockedWord"][] | null; - /** - * Blocked Words File - * @description Path to YAML file containing blocked_words list - */ - blocked_words_file?: string | null; - /** - * Categories - * @description List of prebuilt categories to enable (harmful_*, bias_*) - */ - categories?: components["schemas"]["ContentFilterCategoryConfig"][] | null; - /** @description Threshold configuration for Lakera guardrail categories */ - category_thresholds?: components["schemas"]["LakeraCategoryThresholds"] | null; - /** - * Credentials - * @description Path to Google Cloud credentials JSON file or JSON string - */ - credentials?: string | null; - /** - * Custom Code - * @description Python-like code containing the apply_guardrail function for custom guardrail logic - */ - custom_code?: string | null; - /** - * Default On - * @description Whether the guardrail is enabled by default - */ - default_on?: boolean | null; - /** - * Detect Secrets Config - * @description Configuration for detect-secrets guardrail - */ - detect_secrets_config?: { - [key: string]: unknown; - } | null; - /** - * End Session After N Fails - * @description For /v1/realtime sessions: automatically close the session after this many guardrail violations. - */ - end_session_after_n_fails?: number | null; - /** - * Experimental Use Latest Role Message Only - * @description When True, guardrails only receive the latest message for the relevant role (e.g., newest user input pre-call, newest assistant output post-call) + * Only Scan New Messages + * @description When True, the guardrail only scans messages that have not already been scanned earlier in the same session (identified by litellm_session_id / session_id). Message content is hashed per session and cached; only the diff (new or edited messages) is sent to the guardrail provider on follow-up calls. Falls back to a full scan when the request has no session id or the cache is unavailable. Intended for blocking/detection guardrails; not applied when mask_request_content is set. * @default false */ - experimental_use_latest_role_message_only: boolean | null; - /** - * Extra Headers - * @description Header names to forward from the client request to the guardrail (e.g. x-request-id). Only these headers' values are sent; others may be omitted or sent as [present]. Used by generic_guardrail_api (similar to MCP extra_headers). - */ - extra_headers?: string[] | null; - /** - * Fail On Error - * @description Whether to fail the request if Model Armor encounters an error - * @default true - */ - fail_on_error: boolean | null; - /** - * Guard Name - * @description Name of the guardrail in guardrails.ai - */ - guard_name?: string | null; - /** - * Keyword Redaction Tag - * @description Tag to use for keyword redaction - */ - keyword_redaction_tag?: string | null; - /** - * Location - * @description Google Cloud location/region (e.g., us-central1) - */ - location?: string | null; - /** - * Mask Request Content - * @description Will mask request content if guardrail makes any changes - */ - mask_request_content?: boolean | null; - /** - * Mask Response Content - * @description Will mask response content if guardrail makes any changes - */ - mask_response_content?: boolean | null; - /** - * Model - * @description Optional field if guardrail requires a 'model' parameter - */ - model?: string | null; - /** - * On Violation - * @description For /v1/realtime sessions: 'warn' speaks the violation message and continues; 'end_session' speaks the message and closes the connection. - */ - on_violation?: ("warn" | "end_session") | null; + only_scan_new_messages: boolean | null; /** * Pangea Input Recipe * @description Recipe for input (LLM request) @@ -22466,6 +23024,27 @@ export interface components { * @description The message the bot speaks aloud when a /v1/realtime guardrail fires. Falls back to violation_message_template if not set. */ realtime_violation_message?: string | null; + /** + * Run In Parallel + * @description When True, this pre_call or post_call guardrail runs concurrently with other opted-in guardrails of the same hook, after the sequential guardrails have run. Use only for block-only guardrails that inspect and reject; do not enable it for guardrails that modify the request or response (e.g. PII masking or sensitive-data routing), since parallel runs share one snapshot and their mutations would race. + */ + run_in_parallel?: boolean | null; + /** + * Sanitize Error Detail + * @description For guardrail='model_armor': omit the raw Model Armor response from caller-facing errors and logs by default. Set False to restore verbose output. + * @default true + */ + sanitize_error_detail: boolean | null; + /** + * Scan Only Tool Results + * @description When True, unified guardrails only evaluate tool results, the untrusted data an agent feeds back into the model, and skip system, user, and assistant content. Intended for agent harnesses whose own prompt scaffolding is trusted but often trips prompt-attack detectors. + */ + scan_only_tool_results?: boolean | null; + /** + * Sensitive Data Route To Model + * @description Model to route requests to when sensitive data is detected and on_sensitive_data='route'. This is typically an on-premise model for data privacy. The routing decision persists for the entire session. + */ + sensitive_data_route_to_model?: string | null; /** * Severity Threshold * @description Minimum severity to block (high, medium, low) @@ -22473,17 +23052,39 @@ export interface components { severity_threshold?: string | null; /** * Skip System Message In Guardrail - * @description When True, unified guardrails skip system-role messages when building evaluation inputs (texts and structured_messages). When False, system messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_system_message_in_guardrail setting. + * @description When True, unified guardrails skip system-role messages when building evaluation inputs (texts and structured_messages). When False, system messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_system_message_in_guardrail setting. For Anthropic /v1/messages, the flag applies only to the trusted top-level system prompt. In-sequence system entries are untrusted client input and remain in texts and structured_messages. */ skip_system_message_in_guardrail?: boolean | null; + /** + * Skip Tool Message In Guardrail + * @description When True, unified guardrails skip tool-role messages when building evaluation inputs (texts and structured_messages). When False, tool messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_tool_message_in_guardrail setting. + */ + skip_tool_message_in_guardrail?: boolean | null; + /** + * Skip Unscannable Attachments + * @description Implemented by guardrail='model_armor'. When True, attachment references that carry no inline bytes (file_id, gs://, or http(s) URLs) pass through unscanned instead of blocking, while fail_on_error still governs real Model Armor API errors. Default False blocks them. + * @default false + */ + skip_unscannable_attachments: boolean | null; + /** + * Sticky Session Routing + * @description When True (default), after sensitive data is detected and routed, all subsequent requests in the same session will continue routing to the same model. + * @default true + */ + sticky_session_routing: boolean | null; /** * Template Id * @description The ID of your Model Armor template */ template_id?: string | null; + /** + * Timeout + * @description Per-request timeout for the guardrail provider API call (seconds). Accepts int, float, or numeric string; coerced to float on load. Each guardrail handler chooses its own default when unset. + */ + timeout?: number | null; /** * Unreachable Fallback - * @description Behavior when a guardrail endpoint is unreachable due to network errors. NOTE: This is currently only implemented by guardrail='generic_guardrail_api'. 'fail_closed' raises an error (default). 'fail_open' logs a critical error and allows the request to proceed. + * @description Behavior when a guardrail endpoint is unreachable due to network errors. Implemented by guardrail='generic_guardrail_api', 'akto', 'vigil_guard', 'repelloai', 'headroom', and 'compresr'. 'fail_closed' raises an error (default). 'fail_open' logs a critical error and allows the request to proceed. * @default fail_closed * @enum {string} */ @@ -22498,6 +23099,56 @@ export interface components { }; /** BaseModel */ BaseModel: Record; + /** + * BedrockChecksConfigModel + * @description Inline `checks` config for the resource-less Bedrock InvokeGuardrailChecks API. + * + * Include only the checks you want to run; at least one must be set. + */ + BedrockChecksConfigModel: { + contentFilter?: components["schemas"]["BedrockChecksContentFilterModel"] | null; + promptAttack?: components["schemas"]["BedrockChecksPromptAttackModel"] | null; + sensitiveInformation?: components["schemas"]["BedrockChecksSensitiveInformationModel"] | null; + }; + /** BedrockChecksContentFilterCategoryItem */ + BedrockChecksContentFilterCategoryItem: { + /** + * Category + * @enum {string} + */ + category: "VIOLENCE" | "HATE" | "SEXUAL" | "MISCONDUCT" | "INSULTS"; + }; + /** BedrockChecksContentFilterModel */ + BedrockChecksContentFilterModel: { + /** Categories */ + categories: components["schemas"]["BedrockChecksContentFilterCategoryItem"][]; + }; + /** BedrockChecksPromptAttackCategoryItem */ + BedrockChecksPromptAttackCategoryItem: { + /** + * Category + * @enum {string} + */ + category: "JAILBREAK" | "PROMPT_INJECTION" | "PROMPT_LEAKAGE"; + }; + /** BedrockChecksPromptAttackModel */ + BedrockChecksPromptAttackModel: { + /** Categories */ + categories: components["schemas"]["BedrockChecksPromptAttackCategoryItem"][]; + }; + /** BedrockChecksSensitiveInformationEntityItem */ + BedrockChecksSensitiveInformationEntityItem: { + /** + * Type + * @enum {string} + */ + type: "ADDRESS" | "AGE" | "AWS_ACCESS_KEY" | "AWS_SECRET_KEY" | "CA_HEALTH_NUMBER" | "CA_SOCIAL_INSURANCE_NUMBER" | "CREDIT_DEBIT_CARD_CVV" | "CREDIT_DEBIT_CARD_EXPIRY" | "CREDIT_DEBIT_CARD_NUMBER" | "DRIVER_ID" | "EMAIL" | "INTERNATIONAL_BANK_ACCOUNT_NUMBER" | "IP_ADDRESS" | "LICENSE_PLATE" | "MAC_ADDRESS" | "NAME" | "PASSWORD" | "PHONE" | "PIN" | "SWIFT_CODE" | "UK_NATIONAL_HEALTH_SERVICE_NUMBER" | "UK_NATIONAL_INSURANCE_NUMBER" | "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER" | "URL" | "USERNAME" | "US_BANK_ACCOUNT_NUMBER" | "US_BANK_ROUTING_NUMBER" | "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER" | "US_PASSPORT_NUMBER" | "US_SOCIAL_SECURITY_NUMBER" | "VEHICLE_IDENTIFICATION_NUMBER"; + }; + /** BedrockChecksSensitiveInformationModel */ + BedrockChecksSensitiveInformationModel: { + /** Entities */ + entities: components["schemas"]["BedrockChecksSensitiveInformationEntityItem"][]; + }; /** BlockKeyRequest */ BlockKeyRequest: { /** Key */ @@ -22577,12 +23228,20 @@ export interface components { /** File */ file: string; }; + /** Body_authorize_complete_authorize_complete_post */ + Body_authorize_complete_authorize_complete_post: { + /** Decision */ + decision?: string | null; + /** Delivery */ + delivery?: string | null; + /** Flow */ + flow: string; + /** Team Id */ + team_id?: string | null; + }; /** Body_convert_prompt_file_to_json_utils_dotprompt_json_converter_post */ Body_convert_prompt_file_to_json_utils_dotprompt_json_converter_post: { - /** - * File - * Format: binary - */ + /** File */ file: string; }; /** Body_create_file__provider__v1_files_post */ @@ -22690,6 +23349,13 @@ export interface components { /** Mask[] */ "mask[]"?: string[] | null; }; + /** Body_revoke_endpoint_revoke_post */ + Body_revoke_endpoint_revoke_post: { + /** Client Id */ + client_id: string; + /** Token */ + token: string; + }; /** Body_test_model_connection_health_test_connection_post */ Body_test_model_connection_health_test_connection_post: { /** @@ -22712,6 +23378,48 @@ export interface components { [key: string]: unknown; }; }; + /** Body_token_endpoint__mcp_server_name__token_post */ + Body_token_endpoint__mcp_server_name__token_post: { + /** Client Id */ + client_id: string; + /** Client Secret */ + client_secret?: string | null; + /** Code */ + code?: string; + /** Code Verifier */ + code_verifier?: string; + /** Grant Type */ + grant_type: string; + /** Redirect Uri */ + redirect_uri?: string; + /** Refresh Token */ + refresh_token?: string | null; + /** Resource */ + resource?: string | null; + /** Scope */ + scope?: string | null; + }; + /** Body_token_endpoint_token_post */ + Body_token_endpoint_token_post: { + /** Client Id */ + client_id: string; + /** Client Secret */ + client_secret?: string | null; + /** Code */ + code?: string; + /** Code Verifier */ + code_verifier?: string; + /** Grant Type */ + grant_type: string; + /** Redirect Uri */ + redirect_uri?: string; + /** Refresh Token */ + refresh_token?: string | null; + /** Resource */ + resource?: string | null; + /** Scope */ + scope?: string | null; + }; /** Body_upload_logo_upload_logo_post */ Body_upload_logo_upload_logo_post: { /** File */ @@ -23629,6 +24337,8 @@ export interface components { }; /** ChatCompletionToolParam */ ChatCompletionToolParam: { + /** Allowed Callers */ + allowed_callers?: string[]; cache_control?: components["schemas"]["ChatCompletionCachedContent"]; function: components["schemas"]["ChatCompletionToolParamFunctionChunk"]; /** Type */ @@ -23711,6 +24421,86 @@ export interface components { } & { [key: string]: unknown; }; + /** + * CiscoAIDefenseGuardrailConfigModelOptionalParams + * @description Optional parameters for the Cisco AI Defense guardrail. + */ + CiscoAIDefenseGuardrailConfigModelOptionalParams: { + /** + * Enabled Rules + * @description Explicit list of Cisco AI Defense rules to evaluate. If omitted, the policies configured for the API key in the Cisco AI Defense UI are used. + */ + enabled_rules?: components["schemas"]["CiscoAIDefenseRule"][] | null; + /** + * Fallback On Error + * @description Behaviour when the Cisco AI Defense API is unavailable: 'allow' proceeds without scanning (high availability), 'block' rejects the request (maximum security). + * @default block + */ + fallback_on_error: ("allow" | "block") | null; + /** + * Inspect Path + * @description Override for the inspection endpoint path. Defaults to /api/v1/inspect/chat when inspection_type='chat' and /api/v1/inspect/mcp when inspection_type='mcp'. + */ + inspect_path?: string | null; + /** + * Inspection Type + * @description Which Cisco AI Defense inspection surface to use. 'chat' scans LLM model conversations via /api/v1/inspect/chat. 'mcp' scans MCP tool calls via /api/v1/inspect/mcp. Each guardrail instance targets exactly one surface; configure two guardrails to scan both chat and MCP traffic. + * @default chat + * @enum {string} + */ + inspection_type: "chat" | "mcp"; + /** + * Integration Profile Id + * @description Integration profile id to apply (advanced). + */ + integration_profile_id?: string | null; + /** + * Integration Profile Version + * @description Integration profile version to apply (advanced). + */ + integration_profile_version?: string | null; + /** + * Integration Tenant Id + * @description Integration tenant id to apply (advanced). + */ + integration_tenant_id?: string | null; + /** + * Integration Type + * @description Integration type to apply (advanced). + */ + integration_type?: string | null; + /** + * On Flagged Action + * @description Action to take when Cisco AI Defense flags content. 'block' raises an HTTPException; 'monitor' logs the detection and lets the request continue. + * @default block + */ + on_flagged_action: string | null; + /** + * Timeout + * @description Timeout (seconds) for Cisco AI Defense API calls (1-60). + * @default 10 + */ + timeout: number | null; + } & { + [key: string]: unknown; + }; + /** + * CiscoAIDefenseRule + * @description A single rule to enable for Cisco AI Defense inspection. + */ + CiscoAIDefenseRule: { + /** + * Entity Types + * @description Optional list of entity types for the rule (e.g. 'Email Address', 'Phone Number'). Applies to rules such as PII, PCI, and PHI. + */ + entity_types?: string[] | null; + /** + * Rule Name + * @description The canonical Cisco AI Defense rule name to evaluate. + * @enum {string} + */ + rule_name: "Code Detection" | "Harassment" | "Hate Speech" | "PCI" | "PHI" | "PII" | "Prompt Injection" | "Profanity" | "Sexual Content & Exploitation" | "Social Division & Polarization" | "Violence & Public Safety Threats"; + }; /** CitationsObject */ CitationsObject: { /** Enabled */ @@ -25145,6 +25935,43 @@ export interface components { } & { [key: string]: unknown; }; + /** DiscoverAgentRequest */ + DiscoverAgentRequest: { + /** + * @description How to locate the upstream card. ``well_known_fallback`` for pure A2A agents (try standard paths); ``langgraph_platform`` for LangGraph Platform deployments where the card is shared across assistants and disambiguated by a query parameter. + * @default well_known_fallback + */ + discovery_mode: components["schemas"]["DiscoveryMode"]; + /** + * Params + * @description Mode-specific parameters. ``langgraph_platform`` requires ``{'assistant_id': }``. ``well_known_fallback`` ignores this. + */ + params?: { + [key: string]: unknown; + } | null; + /** + * Url + * @description Base URL of the upstream agent. Behavior depends on ``discovery_mode``: ``well_known_fallback`` (default) tries /.well-known/agent-card.json, /.well-known/agent.json, /agent.json under this URL in order; ``langgraph_platform`` hits ``/.well-known/agent-card.json?assistant_id=`` instead. + */ + url: string; + }; + /** DiscoverAgentResponse */ + DiscoverAgentResponse: { + /** Agent Card */ + agent_card: { + [key: string]: unknown; + }; + /** Url */ + url: string; + }; + /** + * DiscoveryMode + * @description How to locate the upstream agent card. + * + * String-valued so it serializes cleanly over JSON / Pydantic. + * @enum {string} + */ + DiscoveryMode: "well_known_fallback" | "langgraph_platform"; /** * DistinctTagResponse * @description Response for distinct user agent tags @@ -25929,6 +26756,8 @@ export interface components { images?: string[]; /** Model */ model?: string | null; + /** Stream Holdback Chars */ + stream_holdback_chars?: number[]; /** Structured Messages */ structured_messages?: (components["schemas"]["ChatCompletionUserMessage"] | components["schemas"]["ChatCompletionAssistantMessage"] | components["schemas"]["ChatCompletionToolMessage"] | components["schemas"]["ChatCompletionSystemMessage"] | components["schemas"]["ChatCompletionFunctionMessage"] | components["schemas"]["ChatCompletionDeveloperMessage"])[]; /** Texts */ @@ -25962,53 +26791,6 @@ export interface components { /** Starttime */ startTime?: string | null; }; - /** - * GraySwanGuardrailConfigModelOptionalParams - * @description Optional parameters for the Gray Swan guardrail. - */ - GraySwanGuardrailConfigModelOptionalParams: { - /** - * Categories - * @description Default Gray Swan category definitions to send with each request. - */ - categories?: { - [key: string]: string; - } | null; - /** - * Fail Open - * @description If true (default), errors contacting Gray Swan are logged and the request proceeds. If false, errors propagate and block the request. - * @default true - */ - fail_open: boolean | null; - /** - * Guardrail Timeout - * @description Timeout in seconds for calling the Gray Swan guardrail service. - * @default 30 - */ - guardrail_timeout: number | null; - /** - * On Flagged Action - * @description Action when a violation is detected: 'block' rejects the call (400 error), 'monitor' logs only, 'passthrough' replaces response content with violation message (200 status). - * @default passthrough - */ - on_flagged_action: string | null; - /** - * Policy Id - * @description Gray Swan policy identifier to apply during monitoring. - */ - policy_id?: string | null; - /** - * Reasoning Mode - * @description Gray Swan reasoning mode override. Accepted values: 'off', 'hybrid', 'thinking'. - */ - reasoning_mode?: string | null; - /** - * Violation Threshold - * @description Threshold between 0 and 1 at which Gray Swan violations trigger the configured action. - * @default 0.5 - */ - violation_threshold: number | null; - }; /** Guardrail */ Guardrail: { /** Created At */ @@ -26041,7 +26823,7 @@ export interface components { } | null; /** Guardrail Name */ guardrail_name: string; - litellm_params?: components["schemas"]["BaseLitellmParams-Output"] | null; + litellm_params?: components["schemas"]["BaseLitellmParams"] | null; /** Updated At */ updated_at?: string | null; }; @@ -26241,6 +27023,17 @@ export interface components { index_name: string; litellm_params: components["schemas"]["IndexCreateLiteLLMParams"]; }; + /** IndexListResponse */ + IndexListResponse: { + /** Data */ + data: components["schemas"]["LiteLLM_ManagedVectorStoreIndex"][]; + /** + * Object + * @default list + * @constant + */ + object: "list"; + }; /** InputAudio */ InputAudio: { /** Data */ @@ -27028,8 +27821,10 @@ export interface components { approval_status: string | null; /** Args */ args?: string[]; + /** Audience */ + audience?: string | null; /** Auth Type */ - auth_type?: ("none" | "api_key" | "bearer_token" | "basic" | "authorization" | "oauth2" | "aws_sigv4" | "token") | null; + auth_type?: ("none" | "api_key" | "bearer_token" | "basic" | "authorization" | "oauth2" | "aws_sigv4" | "token" | "oauth2_token_exchange" | "oauth2_id_jag" | "true_passthrough" | "oauth_delegate") | null; /** Authorization Url */ authorization_url?: string | null; /** @@ -27043,17 +27838,28 @@ export interface components { byok_description?: string[]; /** Command */ command?: string | null; + /** Connected App Reachable */ + connected_app_reachable?: boolean | null; /** Created At */ created_at?: string | null; /** Created By */ created_by?: string | null; credentials?: components["schemas"]["MCPCredentials"] | null; + /** Dcr Bridge */ + dcr_bridge?: boolean | null; + /** + * Delegate Auth To Upstream + * @default false + */ + delegate_auth_to_upstream: boolean; /** Description */ description?: string | null; /** Env */ env?: { [key: string]: string; }; + /** Env Vars */ + env_vars?: components["schemas"]["MCPEnvVar"][] | null; /** Extra Headers */ extra_headers?: string[]; /** Has User Credential */ @@ -27067,14 +27873,25 @@ export interface components { * @default false */ is_byok: boolean; + /** Issuer */ + issuer?: string | null; /** Last Health Check */ last_health_check?: string | null; + /** Max Concurrent Requests */ + max_concurrent_requests?: number | null; /** Mcp Access Groups */ mcp_access_groups?: string[]; /** Mcp Info */ mcp_info?: { [key: string]: unknown; } | null; + /** Oauth2 Flow */ + oauth2_flow?: ("client_credentials" | "authorization_code") | null; + /** + * Oauth Passthrough + * @default false + */ + oauth_passthrough: boolean; /** Registration Url */ registration_url?: string | null; /** Review Notes */ @@ -27099,6 +27916,8 @@ export interface components { * @default unknown */ status: ("healthy" | "unhealthy" | "unknown") | null; + /** Subject Token Type */ + subject_token_type?: string | null; /** Submitted At */ submitted_at?: string | null; /** Submitted By */ @@ -27107,6 +27926,12 @@ export interface components { teams?: { [key: string]: string | null; }[]; + /** Timeout */ + timeout?: number | null; + /** Token Exchange Endpoint */ + token_exchange_endpoint?: string | null; + /** Token Exchange Profile */ + token_exchange_profile?: string | null; /** Token Url */ token_url?: string | null; /** Tool Name To Description */ @@ -27161,6 +27986,29 @@ export interface components { /** Vector Store Name */ vector_store_name?: string | null; }; + /** + * LiteLLM_ManagedVectorStoreIndex + * @description LiteLLM managed vector store index object - this is is the object stored in the database + */ + LiteLLM_ManagedVectorStoreIndex: { + /** Created At */ + created_at?: string | null; + /** Created By */ + created_by?: string | null; + /** Id */ + id: string; + /** Index Info */ + index_info?: { + [key: string]: unknown; + } | null; + /** Index Name */ + index_name: string; + litellm_params: components["schemas"]["IndexCreateLiteLLMParams"]; + /** Updated At */ + updated_at?: string | null; + /** Updated By */ + updated_by?: string | null; + }; /** * LiteLLM_ManagedVectorStoreListResponse * @description Response format for listing vector stores @@ -27183,31 +28031,31 @@ export interface components { /** LiteLLM_ManagedVectorStoresTable */ LiteLLM_ManagedVectorStoresTable: { /** Created At */ - created_at: string | null; + created_at?: string | null; /** Custom Llm Provider */ custom_llm_provider: string; /** Litellm Credential Name */ - litellm_credential_name: string | null; + litellm_credential_name?: string | null; /** Litellm Params */ - litellm_params: { + litellm_params?: { [key: string]: unknown; } | null; /** Team Id */ - team_id: string | null; + team_id?: string | null; /** Updated At */ - updated_at: string | null; + updated_at?: string | null; /** User Id */ - user_id: string | null; + user_id?: string | null; /** Vector Store Description */ - vector_store_description: string | null; + vector_store_description?: string | null; /** Vector Store Id */ vector_store_id: string; /** Vector Store Metadata */ - vector_store_metadata: { + vector_store_metadata?: { [key: string]: unknown; } | null; /** Vector Store Name */ - vector_store_name: string | null; + vector_store_name?: string | null; }; /** LiteLLM_MemoryRow */ LiteLLM_MemoryRow: { @@ -28502,7 +29350,7 @@ export interface components { anonymize_input?: boolean | null; /** * Api Base - * @description Base URL for the Lakera AI API + * @description Regional base URL for the Cisco AI Defense Inspection API. Defaults to https://us.api.inspect.aidefense.security.cisco.com. Supported regions: us (us-west-2), ap (ap-ne-1), eu (eu-central-1). The environment variable `CISCO_AI_DEFENSE_API_BASE` is consulted as a fallback. The endpoint path is derived from inspection_type (/api/v1/inspect/chat for 'chat', /api/v1/inspect/mcp for 'mcp'). */ api_base?: string | null; /** @@ -28517,7 +29365,7 @@ export interface components { api_id?: string | null; /** * Api Key - * @description API key for the Lakera AI service + * @description API key for the Cisco AI Defense inspection endpoint. If not provided, the `CISCO_AI_DEFENSE_API_KEY` environment variable is used. Sent in the `X-Cisco-AI-Defense-API-Key` header. Both the chat and MCP endpoints use this key. */ api_key?: string | null; /** @@ -28541,6 +29389,11 @@ export interface components { * @description Custom assertions to validate against the output. Each assertion is a string describing a condition. */ assertions?: string[] | null; + /** + * Asset Id + * @description Repello asset ID whose dashboard policies are enforced. Required; the guardrail raises at init if it is missing. + */ + asset_id?: string | null; /** * Async Mode * @description Set to True to request asynchronous analysis (sets `plr_async` header). Defaults to provider behaviour when omitted. @@ -28650,6 +29503,14 @@ export interface components { categories?: components["schemas"]["ContentFilterCategoryConfig"][] | null; /** @description Threshold configuration for Lakera guardrail categories */ category_thresholds?: components["schemas"]["LakeraCategoryThresholds"] | null; + /** @description Inline safeguards for the resource-less InvokeGuardrailChecks API (contentFilter / promptAttack / sensitiveInformation). When set, the guardrail calls InvokeGuardrailChecks instead of ApplyGuardrail and no guardrailIdentifier is required. Mutually exclusive with guardrailIdentifier. */ + checks?: components["schemas"]["BedrockChecksConfigModel"] | null; + /** + * Chunk Budget Chars + * @description ApplyGuardrail: batch size, in characters, used to re-send content after AWS has rejected a request as too large. Requests AWS accepts are always sent in a single call, so this has no effect until a rejection happens. Defaults to 25,000; a batch AWS still rejects is bisected automatically, so this value only trades round trips against batch size and cannot fail a request on its own. + * @default 25000 + */ + chunk_budget_chars: number; /** * Confidence Threshold * @description Only block or mask when detection confidence >= this value; below threshold, allow or log_only. @@ -28663,6 +29524,12 @@ export interface components { config?: { [key: string]: unknown; } | null; + /** + * Content Filter Threshold + * @description InvokeGuardrailChecks: block when any contentFilter severityScore >= this value (scores are in [0,1]). Set to null to make the content filter detect-only (logged, never blocks). + * @default 0.5 + */ + content_filter_threshold: number | null; /** * Content Moderation Check * @description Enable content moderation to check for harmful content (harassment, hate speech, etc.). @@ -28678,6 +29545,11 @@ export interface components { * @description Python-like code containing the apply_guardrail function for custom guardrail logic */ custom_code?: string | null; + /** + * Deepkeep Firewall Id + * @description The DeepKeep Firewall ID to use for guardrail evaluation. If not provided, the `DEEPKEEP_FIREWALL_ID` environment variable is checked. + */ + deepkeep_firewall_id?: string | null; /** * Default Action * @description Fallback decision when no rule matches @@ -28755,7 +29627,7 @@ export interface components { extra_headers?: string[] | null; /** * Fail On Error - * @description Whether to fail the request if Model Armor encounters an error + * @description Whether to fail the request if the guardrail encounters an error. Implemented by guardrail='model_armor' and 'generic_guardrail_api'. True (default) raises the error. False logs a critical error and lets the request proceed, so only a valid guardrail response can block or modify it. * @default true */ fail_on_error: boolean | null; @@ -28874,7 +29746,7 @@ export interface components { mode: string | string[] | components["schemas"]["Mode"]; /** * Model - * @description Optional field if guardrail requires a 'model' parameter + * @description Model name forwarded to the headroom /v1/compress endpoint. */ model?: string | null; /** @@ -28901,13 +29773,24 @@ export interface components { * @default monitor */ on_flagged_action: string | null; + /** + * On Sensitive Data + * @description Action to take when sensitive data is detected. 'block' raises an exception (default behavior). 'route' reroutes the request to the model specified in sensitive_data_route_to_model. + */ + on_sensitive_data?: ("block" | "route") | null; /** * On Violation * @description For /v1/realtime sessions: 'warn' speaks the violation message and continues; 'end_session' speaks the message and closes the connection. */ on_violation?: ("warn" | "end_session") | null; + /** + * Only Scan New Messages + * @description When True, the guardrail only scans messages that have not already been scanned earlier in the same session (identified by litellm_session_id / session_id). Message content is hashed per session and cached; only the diff (new or edited messages) is sent to the guardrail provider on follow-up calls. Falls back to a full scan when the request has no session id or the cache is unavailable. Intended for blocking/detection guardrails; not applied when mask_request_content is set. + * @default false + */ + only_scan_new_messages: boolean | null; /** @description Optional parameters for the guardrail */ - optional_params?: components["schemas"]["GraySwanGuardrailConfigModelOptionalParams"] | null; + optional_params?: components["schemas"]["CiscoAIDefenseGuardrailConfigModelOptionalParams"] | null; /** * Output Parse Pii * @description When True, LiteLLM will replace the masked text with the original text in the response @@ -28949,6 +29832,12 @@ export interface components { * @description Enable PII (Personally Identifiable Information) detection. */ pii_check?: boolean | null; + /** + * Pii Confidence Threshold + * @description InvokeGuardrailChecks: block when any sensitiveInformation confidenceScore >= this value (scores are in [0,1]). Set to null to make PII detection detect-only. + * @default 0.5 + */ + pii_confidence_threshold: number | null; /** * Pii Entities Config * @description Configuration for PII entity types and actions @@ -28971,6 +29860,16 @@ export interface components { * @description XecGuard policies to apply on each scan. Select one or more of the built-in default policies; if none are selected, the guardrail defaults to System Prompt Enforcement + Harmful Content Protection. */ policy_names?: string[] | null; + /** + * Post Checkpoint Id + * @description Post-checkpoint ID for the Ovalix Tracker service. + */ + post_checkpoint_id?: string | null; + /** + * Pre Checkpoint Id + * @description Pre-checkpoint ID for the Ovalix Tracker service. + */ + pre_checkpoint_id?: string | null; /** * Presidio Ad Hoc Recognizers * @description Path to a JSON file containing ad-hoc recognizers for Presidio @@ -29019,6 +29918,12 @@ export interface components { * @description Project ID for the Lakera AI project */ project_id?: string | null; + /** + * Prompt Attack Threshold + * @description InvokeGuardrailChecks: block when any promptAttack severityScore >= this value (scores are in [0,1]). Set to null to make prompt-attack detection detect-only. + * @default 0.5 + */ + prompt_attack_threshold: number | null; /** * Prompt Injections * @description Enable prompt injection detection. Default check if no evaluation_id and no other checks are specified. @@ -29034,6 +29939,22 @@ export interface components { * @description Ordered allow/deny rules. Patterns use regex for tool names/types and optional regex constraints on tool arguments. */ rules?: components["schemas"]["ToolPermissionRule"][] | null; + /** + * Run In Parallel + * @description When True, this pre_call or post_call guardrail runs concurrently with other opted-in guardrails of the same hook, after the sequential guardrails have run. Use only for block-only guardrails that inspect and reject; do not enable it for guardrails that modify the request or response (e.g. PII masking or sensitive-data routing), since parallel runs share one snapshot and their mutations would race. + */ + run_in_parallel?: boolean | null; + /** + * Sanitize Error Detail + * @description For guardrail='model_armor': omit the raw Model Armor response from caller-facing errors and logs by default. Set False to restore verbose output. + * @default true + */ + sanitize_error_detail: boolean | null; + /** + * Scan Only Tool Results + * @description When True, unified guardrails only evaluate tool results, the untrusted data an agent feeds back into the model, and skip system, user, and assistant content. Intended for agent harnesses whose own prompt scaffolding is trusted but often trips prompt-attack detectors. + */ + scan_only_tool_results?: boolean | null; /** * Send User Api Key Alias * @description Whether to send user_API_key_alias in headers @@ -29052,29 +29973,86 @@ export interface components { * @default false */ send_user_api_key_user_id: boolean | null; + /** + * Sensitive Data Route To Model + * @description Model to route requests to when sensitive data is detected and on_sensitive_data='route'. This is typically an on-premise model for data privacy. The routing decision persists for the entire session. + */ + sensitive_data_route_to_model?: string | null; /** * Severity Threshold * @description Minimum severity to block (high, medium, low) */ severity_threshold?: string | null; + /** + * Singulr Api Base + * @description The Singulr API base URL. Get base URL from Singulr Platform. + */ + singulr_api_base?: string | null; + /** + * Singulr Api Key + * @description The Singulr API key. Generate API key from Singulr Platform. + */ + singulr_api_key?: string | null; + /** + * Singulr Application Id + * @description The Singulr application ID. Get application ID from Singulr Platform. + */ + singulr_application_id?: string | null; + /** + * Singulr Guardrail Id + * @description The Singulr Guardrail ID. Get guardrail ID from Singulr Platform. + */ + singulr_guardrail_id?: string | null; /** * Skip System Message In Guardrail - * @description When True, unified guardrails skip system-role messages when building evaluation inputs (texts and structured_messages). When False, system messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_system_message_in_guardrail setting. + * @description When True, unified guardrails skip system-role messages when building evaluation inputs (texts and structured_messages). When False, system messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_system_message_in_guardrail setting. For Anthropic /v1/messages, the flag applies only to the trusted top-level system prompt. In-sequence system entries are untrusted client input and remain in texts and structured_messages. */ skip_system_message_in_guardrail?: boolean | null; + /** + * Skip Tool Message In Guardrail + * @description When True, unified guardrails skip tool-role messages when building evaluation inputs (texts and structured_messages). When False, tool messages are included even if litellm_settings sets a global skip. When None, use the global litellm.skip_tool_message_in_guardrail setting. + */ + skip_tool_message_in_guardrail?: boolean | null; + /** + * Skip Unscannable Attachments + * @description Implemented by guardrail='model_armor'. When True, attachment references that carry no inline bytes (file_id, gs://, or http(s) URLs) pass through unscanned instead of blocking, while fail_on_error still governs real Model Armor API errors. Default False blocks them. + * @default false + */ + skip_unscannable_attachments: boolean | null; + /** + * Sticky Session Routing + * @description When True (default), after sensitive data is detected and routed, all subsequent requests in the same session will continue routing to the same model. + * @default true + */ + sticky_session_routing: boolean | null; /** * Template Id * @description The ID of your Model Armor template */ template_id?: string | null; + /** + * Timeout + * @description Per-request timeout for the guardrail provider API call (seconds). Accepts int, float, or numeric string; coerced to float on load. Each guardrail handler chooses its own default when unset. + */ + timeout?: number | null; /** * Tool Selection Quality Check * @description Enable tool selection quality check to evaluate quality of tool/function calls. */ tool_selection_quality_check?: boolean | null; + /** + * Tracker Api Base + * @description Base URL for the Ovalix Tracker service. + */ + tracker_api_base?: string | null; + /** + * Tracker Api Key + * @description API key for the Ovalix Tracker service. + */ + tracker_api_key?: string | null; /** * Unreachable Fallback - * @description What to do when Akto is unreachable. 'fail_open' = allow, 'fail_closed' = block. + * @description Behavior when the headroom compression service is unreachable or errors. 'fail_closed' raises an error (default). 'fail_open' logs a critical error and forwards the request uncompressed instead of blocking it. * @default fail_closed * @enum {string} */ @@ -29145,6 +30123,8 @@ export interface components { }; /** MCPCredentials */ MCPCredentials: { + /** Audience */ + audience?: string | null; /** Auth Value */ auth_value?: string | null; /** Aws Access Key Id */ @@ -29161,13 +30141,68 @@ export interface components { aws_session_name?: string | null; /** Aws Session Token */ aws_session_token?: string | null; + /** Client Assertion Signing Alg */ + client_assertion_signing_alg?: string | null; /** Client Id */ client_id?: string | null; + /** Client Private Key */ + client_private_key?: string | null; + /** Client Private Key Id */ + client_private_key_id?: string | null; /** Client Secret */ client_secret?: string | null; + /** Id Jag Resource */ + id_jag_resource?: string | null; + /** Id Jag Resource Token Endpoint */ + id_jag_resource_token_endpoint?: string | null; + /** Redirect Uris */ + redirect_uris?: string[] | null; /** Scopes */ scopes?: string[] | null; + /** Subject Token Type */ + subject_token_type?: string | null; + /** Token Endpoint Auth Method */ + token_endpoint_auth_method?: ("client_secret_basic" | "client_secret_post") | null; + /** Token Exchange Endpoint */ + token_exchange_endpoint?: string | null; + /** Token Exchange Profile */ + token_exchange_profile?: string | null; + /** Upstream Resource */ + upstream_resource?: string | null; }; + /** + * MCPEnvVar + * @description One environment variable for an MCP server. + * + * Variables can be interpolated into ``static_headers`` using ``${NAME}`` + * syntax. ``scope=global`` values are stored on the server. ``scope=user`` + * values are stored per-user in ``LiteLLM_MCPUserEnvVars`` and supplied by + * each user. + */ + MCPEnvVar: { + /** Description */ + description?: string | null; + /** Name */ + name: string; + /** @default global */ + scope: components["schemas"]["MCPEnvVarScope"]; + /** + * Value + * @default + */ + value: string; + }; + /** + * MCPEnvVarScope + * @description Scope for an MCP server environment variable. + * + * - ``global``: value is provided by the admin and used for all users. + * - ``user``: each user must provide their own value via the per-user + * env-var endpoint. The admin-supplied ``value`` is treated as a + * placeholder/hint and is not used at request time. + * @enum {string} + */ + MCPEnvVarScope: "global" | "user"; /** * MCPOAuthUserCredentialRequest * @description Stores a user's OAuth2 token for an OpenAPI MCP server. @@ -29329,6 +30364,55 @@ export interface components { /** Server Id */ server_id: string; }; + /** + * MCPUserEnvVarSpec + * @description Describes one per-user env var slot for the calling user. + * + * Stored values are write-only: the status only reports whether a value + * ``is_set`` and never echoes the decrypted secret back to the client. + */ + MCPUserEnvVarSpec: { + /** Description */ + description?: string | null; + /** + * Is Set + * @default false + */ + is_set: boolean; + /** Name */ + name: string; + }; + /** + * MCPUserEnvVarsRequest + * @description Payload for storing the calling user's per-user env var values. + */ + MCPUserEnvVarsRequest: { + /** Values */ + values: { + [key: string]: string; + }; + }; + /** + * MCPUserEnvVarsStatus + * @description Per-user env var status for a single MCP server. + */ + MCPUserEnvVarsStatus: { + /** Alias */ + alias?: string | null; + /** + * Missing Count + * @default 0 + */ + missing_count: number; + /** Required */ + required?: components["schemas"]["MCPUserEnvVarSpec"][]; + /** Server Id */ + server_id: string; + /** Server Name */ + server_name?: string | null; + /** Setup Url */ + setup_url?: string | null; + }; /** MakeAgentsPublicRequest */ MakeAgentsPublicRequest: { /** Agent Ids */ @@ -29741,8 +30825,10 @@ export interface components { approval_status?: string | null; /** Args */ args?: string[]; + /** Audience */ + audience?: string | null; /** Auth Type */ - auth_type?: ("none" | "api_key" | "bearer_token" | "basic" | "authorization" | "oauth2" | "aws_sigv4" | "token") | null; + auth_type?: ("none" | "api_key" | "bearer_token" | "basic" | "authorization" | "oauth2" | "aws_sigv4" | "token" | "oauth2_token_exchange" | "oauth2_id_jag" | "true_passthrough" | "oauth_delegate") | null; /** Authorization Url */ authorization_url?: string | null; /** @@ -29757,12 +30843,21 @@ export interface components { /** Command */ command?: string | null; credentials?: components["schemas"]["MCPCredentials"] | null; + /** Dcr Bridge */ + dcr_bridge?: boolean | null; + /** + * Delegate Auth To Upstream + * @default false + */ + delegate_auth_to_upstream: boolean; /** Description */ description?: string | null; /** Env */ env?: { [key: string]: string; }; + /** Env Vars */ + env_vars?: components["schemas"]["MCPEnvVar"][] | null; /** Extra Headers */ extra_headers?: string[] | null; /** Instructions */ @@ -29772,6 +30867,10 @@ export interface components { * @default false */ is_byok: boolean; + /** Issuer */ + issuer?: string | null; + /** Max Concurrent Requests */ + max_concurrent_requests?: number | null; /** Mcp Access Groups */ mcp_access_groups?: string[]; /** Mcp Info */ @@ -29780,6 +30879,11 @@ export interface components { } | null; /** Oauth2 Flow */ oauth2_flow?: ("client_credentials" | "authorization_code") | null; + /** + * Oauth Passthrough + * @default false + */ + oauth_passthrough: boolean; /** Registration Url */ registration_url?: string | null; /** Server Id */ @@ -29794,6 +30898,8 @@ export interface components { static_headers?: { [key: string]: string; } | null; + /** Subject Token Type */ + subject_token_type?: string | null; /** * Submitted At * @description Server-managed: set by the endpoint; caller values are overridden. @@ -29804,6 +30910,12 @@ export interface components { * @description Server-managed: set by the endpoint; caller values are overridden. */ submitted_by?: string | null; + /** Timeout */ + timeout?: number | null; + /** Token Exchange Endpoint */ + token_exchange_endpoint?: string | null; + /** Token Exchange Profile */ + token_exchange_profile?: string | null; /** Token Url */ token_url?: string | null; /** Tool Name To Description */ @@ -30847,7 +31959,7 @@ export interface components { } | null; /** Guardrail Name */ guardrail_name?: string | null; - litellm_params?: components["schemas"]["BaseLitellmParams-Input"] | null; + litellm_params?: components["schemas"]["BaseLitellmParams"] | null; }; /** PatchPromptRequest */ PatchPromptRequest: { @@ -31029,7 +32141,7 @@ export interface components { * PiiEntityType * @enum {string} */ - PiiEntityType: "CREDIT_CARD" | "CRYPTO" | "DATE_TIME" | "EMAIL_ADDRESS" | "IBAN_CODE" | "IP_ADDRESS" | "NRP" | "LOCATION" | "PERSON" | "PHONE_NUMBER" | "MEDICAL_LICENSE" | "URL" | "US_BANK_NUMBER" | "US_DRIVER_LICENSE" | "US_ITIN" | "US_PASSPORT" | "US_SSN" | "UK_NHS" | "UK_NINO" | "ES_NIF" | "ES_NIE" | "IT_FISCAL_CODE" | "IT_DRIVER_LICENSE" | "IT_VAT_CODE" | "IT_PASSPORT" | "IT_IDENTITY_CARD" | "PL_PESEL" | "SG_NRIC_FIN" | "SG_UEN" | "AU_ABN" | "AU_ACN" | "AU_TFN" | "AU_MEDICARE" | "IN_PAN" | "IN_AADHAAR" | "IN_VEHICLE_REGISTRATION" | "IN_VOTER" | "IN_PASSPORT" | "FI_PERSONAL_IDENTITY_CODE"; + PiiEntityType: "CREDIT_CARD" | "CRYPTO" | "DATE_TIME" | "EMAIL_ADDRESS" | "IBAN_CODE" | "IP_ADDRESS" | "NRP" | "LOCATION" | "PERSON" | "PHONE_NUMBER" | "MEDICAL_LICENSE" | "URL" | "US_BANK_NUMBER" | "US_DRIVER_LICENSE" | "US_ITIN" | "US_PASSPORT" | "US_SSN" | "UK_NHS" | "UK_NINO" | "UK_PASSPORT" | "UK_POSTCODE" | "UK_VEHICLE_REGISTRATION" | "ES_NIF" | "ES_NIE" | "IT_FISCAL_CODE" | "IT_DRIVER_LICENSE" | "IT_VAT_CODE" | "IT_PASSPORT" | "IT_IDENTITY_CARD" | "PL_PESEL" | "SG_NRIC_FIN" | "SG_UEN" | "AU_ABN" | "AU_ACN" | "AU_TFN" | "AU_MEDICARE" | "IN_PAN" | "IN_AADHAAR" | "IN_VEHICLE_REGISTRATION" | "IN_VOTER" | "IN_PASSPORT" | "FI_PERSONAL_IDENTITY_CODE"; /** * PipelineTestRequest * @description Request body for testing a guardrail pipeline with sample messages. @@ -32190,6 +33302,21 @@ export interface components { /** Value */ value: string; }; + /** + * RealtimeTranscriptionSessionResponse + * @description Response from POST /v1/realtime/transcription_sessions. + * + * `client_secret.value` contains the encrypted token instead of the raw + * ephemeral key. Unknown fields pass through unchanged. + */ + RealtimeTranscriptionSessionResponse: { + /** Client Secret */ + client_secret?: { + [key: string]: unknown; + } | null; + } & { + [key: string]: unknown; + }; /** RegenerateKeyRequest */ RegenerateKeyRequest: { /** Access Group Ids */ @@ -32955,6 +34082,20 @@ export interface components { /** Run Id */ run_id: string; }; + /** SCIMEnterpriseUser */ + SCIMEnterpriseUser: { + /** Costcenter */ + costCenter?: string | null; + /** Department */ + department?: string | null; + /** Division */ + division?: string | null; + /** Employeenumber */ + employeeNumber?: string | null; + manager?: components["schemas"]["SCIMUserManager"] | null; + /** Organization */ + organization?: string | null; + }; /** SCIMFeature */ SCIMFeature: { /** Maxoperations */ @@ -32986,7 +34127,7 @@ export interface components { /** SCIMListResponse */ SCIMListResponse: { /** Resources */ - Resources: components["schemas"]["SCIMUser"][] | components["schemas"]["SCIMGroup"][]; + Resources: components["schemas"]["SCIMUser-Output"][] | components["schemas"]["SCIMGroup"][]; /** * Itemsperpage * @default 10 @@ -33011,6 +34152,19 @@ export interface components { SCIMMember: { /** Display */ display?: string | null; + /** Type */ + type?: string | null; + /** Value */ + value: string; + }; + /** SCIMMultiValuedAttribute */ + SCIMMultiValuedAttribute: { + /** Display */ + display?: string | null; + /** Primary */ + primary?: boolean | null; + /** Type */ + type?: string | null; /** Value */ value: string; }; @@ -33090,7 +34244,7 @@ export interface components { sort: components["schemas"]["SCIMFeature"]; }; /** SCIMUser */ - SCIMUser: { + "SCIMUser-Input": { /** * Active * @default true @@ -33100,6 +34254,8 @@ export interface components { displayName?: string | null; /** Emails */ emails?: components["schemas"]["SCIMUserEmail"][] | null; + /** Entitlements */ + entitlements?: components["schemas"]["SCIMMultiValuedAttribute"][] | null; /** Externalid */ externalId?: string | null; /** Groups */ @@ -33111,11 +34267,17 @@ export interface components { [key: string]: unknown; } | null; name?: components["schemas"]["SCIMUserName"] | null; + /** Roles */ + roles?: components["schemas"]["SCIMMultiValuedAttribute"][] | null; /** Schemas */ schemas: string[]; + "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"?: components["schemas"]["SCIMEnterpriseUser"] | null; /** Username */ userName?: string | null; }; + "SCIMUser-Output": { + [key: string]: unknown; + }; /** SCIMUserEmail */ SCIMUserEmail: { /** Primary */ @@ -33140,6 +34302,15 @@ export interface components { /** Value */ value: string; }; + /** SCIMUserManager */ + SCIMUserManager: { + /** $Ref */ + $ref?: string | null; + /** Displayname */ + displayName?: string | null; + /** Value */ + value?: string | null; + }; /** SCIMUserName */ SCIMUserName: { /** Familyname */ @@ -35097,8 +36268,10 @@ export interface components { allowed_tools?: string[] | null; /** Args */ args?: string[]; + /** Audience */ + audience?: string | null; /** Auth Type */ - auth_type?: ("none" | "api_key" | "bearer_token" | "basic" | "authorization" | "oauth2" | "aws_sigv4" | "token") | null; + auth_type?: ("none" | "api_key" | "bearer_token" | "basic" | "authorization" | "oauth2" | "aws_sigv4" | "token" | "oauth2_token_exchange" | "oauth2_id_jag" | "true_passthrough" | "oauth_delegate") | null; /** Authorization Url */ authorization_url?: string | null; /** @@ -35113,12 +36286,21 @@ export interface components { /** Command */ command?: string | null; credentials?: components["schemas"]["MCPCredentials"] | null; + /** Dcr Bridge */ + dcr_bridge?: boolean | null; + /** + * Delegate Auth To Upstream + * @default false + */ + delegate_auth_to_upstream: boolean; /** Description */ description?: string | null; /** Env */ env?: { [key: string]: string; }; + /** Env Vars */ + env_vars?: components["schemas"]["MCPEnvVar"][] | null; /** Extra Headers */ extra_headers?: string[] | null; /** Instructions */ @@ -35128,12 +36310,23 @@ export interface components { * @default false */ is_byok: boolean; + /** Issuer */ + issuer?: string | null; + /** Max Concurrent Requests */ + max_concurrent_requests?: number | null; /** Mcp Access Groups */ mcp_access_groups?: string[]; /** Mcp Info */ mcp_info?: { [key: string]: unknown; } | null; + /** Oauth2 Flow */ + oauth2_flow?: ("client_credentials" | "authorization_code") | null; + /** + * Oauth Passthrough + * @default false + */ + oauth_passthrough: boolean; /** Registration Url */ registration_url?: string | null; /** Server Id */ @@ -35148,6 +36341,14 @@ export interface components { static_headers?: { [key: string]: string; } | null; + /** Subject Token Type */ + subject_token_type?: string | null; + /** Timeout */ + timeout?: number | null; + /** Token Exchange Endpoint */ + token_exchange_endpoint?: string | null; + /** Token Exchange Profile */ + token_exchange_profile?: string | null; /** Token Url */ token_url?: string | null; /** Tool Name To Description */ @@ -37047,6 +38248,46 @@ export interface operations { }; }; }; + jwks_json__well_known_jwks_json_get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + }; + }; + native_client_auth_discovery__well_known_litellm_cli_auth_get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + }; + }; get_ui_config__well_known_litellm_ui_config_get: { parameters: { query?: never; @@ -37067,6 +38308,283 @@ export interface operations { }; }; }; + oauth_authorization_server_mcp__well_known_oauth_authorization_server_get: { + parameters: { + query?: { + mcp_server_name?: string | null; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + oauth_authorization_server_aggregate__well_known_oauth_authorization_server_mcp_get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + }; + }; + oauth_authorization_server_mcp_standard__well_known_oauth_authorization_server_mcp__mcp_server_name__get: { + parameters: { + query?: never; + header?: never; + path: { + mcp_server_name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + oauth_authorization_server_mcp__well_known_oauth_authorization_server__mcp_server_name__get: { + parameters: { + query?: never; + header?: never; + path: { + mcp_server_name: string | null; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + oauth_authorization_server_legacy__well_known_oauth_authorization_server__mcp_server_name__mcp_get: { + parameters: { + query?: never; + header?: never; + path: { + mcp_server_name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + oauth_protected_resource_mcp__well_known_oauth_protected_resource_get: { + parameters: { + query?: { + mcp_server_name?: string | null; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + oauth_protected_resource_aggregate__well_known_oauth_protected_resource_mcp_get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + }; + }; + oauth_protected_resource_mcp_standard__well_known_oauth_protected_resource_mcp__mcp_server_name__get: { + parameters: { + query?: never; + header?: never; + path: { + mcp_server_name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + oauth_protected_resource_mcp__well_known_oauth_protected_resource__mcp_server_name__mcp_get: { + parameters: { + query?: never; + header?: never; + path: { + mcp_server_name: string | null; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + openid_configuration__well_known_openid_configuration_get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + }; + }; invoke_agent_a2a_a2a__agent_id__post: { parameters: { query?: never; @@ -38113,6 +39631,78 @@ export interface operations { }; }; }; + authorize_authorize_get: { + parameters: { + query: { + redirect_uri: string; + client_id?: string | null; + state?: string; + mcp_server_name?: string | null; + code_challenge?: string | null; + code_challenge_method?: string | null; + response_type?: string | null; + scope?: string | null; + resource?: string | null; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + authorize_complete_authorize_complete_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/x-www-form-urlencoded": components["schemas"]["Body_authorize_complete_authorize_complete_post"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; get_auto_router_benchmarks_auto_router_benchmarks_get: { parameters: { query?: { @@ -39324,6 +40914,41 @@ export interface operations { }; }; }; + callback_callback_get: { + parameters: { + query?: { + code?: string | null; + state?: string | null; + error?: string | null; + error_description?: string | null; + error_uri?: string | null; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; get_callback_configs_callbacks_configs_get: { parameters: { query?: never; @@ -40860,7 +42485,10 @@ export interface operations { update_hashicorp_vault_config_config_overrides_hashicorp_vault_post: { parameters: { query?: never; - header?: never; + header?: { + /** @description The litellm-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability */ + "litellm-changed-by"?: string | null; + }; path?: never; cookie?: never; }; @@ -40893,7 +42521,10 @@ export interface operations { delete_hashicorp_vault_config_config_overrides_hashicorp_vault_delete: { parameters: { query?: never; - header?: never; + header?: { + /** @description The litellm-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability */ + "litellm-changed-by"?: string | null; + }; path?: never; cookie?: never; }; @@ -40908,6 +42539,15 @@ export interface operations { "application/json": unknown; }; }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; }; }; test_hashicorp_vault_connection_config_overrides_hashicorp_vault_test_connection_post: { @@ -47133,6 +48773,12 @@ export interface operations { query?: { /** @description The server id to list tools for */ server_id?: string | null; + /** @description Filter tools to a single MCP server by name or alias */ + mcp_server_name?: string | null; + /** @description Filter tools to a single toolset by name */ + toolset_name?: string | null; + /** @description Admin only. Return the full server tool catalog without the allowed_tools filter or per-key tool permissions, so the MCP settings UI can configure the allowlist. Ignored for non-admins. */ + include_disabled_tools?: boolean; }; header?: never; path?: never; @@ -48886,6 +50532,26 @@ export interface operations { }; }; }; + create_realtime_transcription_session_openai_v1_realtime_transcription_sessions_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["RealtimeTranscriptionSessionResponse"]; + }; + }; + }; + }; responses_api_openai_v1_responses_post: { parameters: { query?: never; @@ -51701,6 +53367,57 @@ export interface operations { }; }; }; + create_realtime_transcription_session_realtime_transcription_sessions_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["RealtimeTranscriptionSessionResponse"]; + }; + }; + }; + }; + register_client_register_post: { + parameters: { + query?: { + mcp_server_name?: string | null; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; reload_anthropic_beta_headers_reload_anthropic_beta_headers_post: { parameters: { query?: never; @@ -51943,6 +53660,39 @@ export interface operations { }; }; }; + revoke_endpoint_revoke_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/x-www-form-urlencoded": components["schemas"]["Body_revoke_endpoint_revoke_post"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; get_robots_robots_txt_get: { parameters: { query?: never; @@ -52607,7 +54357,7 @@ export interface operations { }; requestBody: { content: { - "application/json": components["schemas"]["SCIMUser"]; + "application/json": components["schemas"]["SCIMUser-Input"]; }; }; responses: { @@ -52617,7 +54367,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["SCIMUser"]; + "application/json": components["schemas"]["SCIMUser-Output"]; }; }; /** @description Validation Error */ @@ -52650,7 +54400,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["SCIMUser"]; + "application/json": components["schemas"]["SCIMUser-Output"]; }; }; /** @description Validation Error */ @@ -52677,7 +54427,7 @@ export interface operations { }; requestBody: { content: { - "application/json": components["schemas"]["SCIMUser"]; + "application/json": components["schemas"]["SCIMUser-Input"]; }; }; responses: { @@ -52687,7 +54437,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["SCIMUser"]; + "application/json": components["schemas"]["SCIMUser-Output"]; }; }; /** @description Validation Error */ @@ -52755,7 +54505,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["SCIMUser"]; + "application/json": components["schemas"]["SCIMUser-Output"]; }; }; /** @description Validation Error */ @@ -55345,6 +57095,41 @@ export interface operations { }; }; }; + token_endpoint_token_post: { + parameters: { + query?: { + mcp_server_name?: string | null; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/x-www-form-urlencoded": components["schemas"]["Body_token_endpoint_token_post"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; toolset_mcp_route_toolset__toolset_name__mcp_get: { parameters: { query?: never; @@ -56458,6 +58243,39 @@ export interface operations { }; }; }; + discover_agent_card_v1_a2a_discover_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["DiscoverAgentRequest"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["DiscoverAgentResponse"]; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; invoke_agent_a2a_v1_a2a__agent_id__message_send_post: { parameters: { query?: never; @@ -58482,6 +60300,26 @@ export interface operations { }; }; }; + index_list_v1_indexes_get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["IndexListResponse"]; + }; + }; + }; + }; index_create_v1_indexes_post: { parameters: { query?: never; @@ -58667,6 +60505,8 @@ export interface operations { query?: { /** @description Filter MCP servers by team scope. When provided, returns only servers the team has access to plus globally available (allow_all_keys) servers. Used by the Create Key UI to show team-scoped MCP servers. */ team_id?: string | null; + /** @description Annotate each returned server with connected_app_reachable: whether a connected app authorized by the calling user (a gateway OAuth session) is served this server on the aggregate MCP endpoint. */ + connected_app_view?: boolean; }; header?: never; path?: never; @@ -59181,6 +61021,103 @@ export interface operations { }; }; }; + get_mcp_user_env_vars_v1_mcp_server__server_id__user_env_vars_get: { + parameters: { + query?: never; + header?: never; + path: { + server_id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["MCPUserEnvVarsStatus"]; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + store_mcp_user_env_vars_v1_mcp_server__server_id__user_env_vars_post: { + parameters: { + query?: never; + header?: never; + path: { + server_id: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["MCPUserEnvVarsRequest"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["MCPUserEnvVarsStatus"]; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + clear_mcp_user_env_vars_v1_mcp_server__server_id__user_env_vars_delete: { + parameters: { + query?: never; + header?: never; + path: { + server_id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["MCPUserEnvVarsStatus"]; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; get_mcp_tools_v1_mcp_tools_get: { parameters: { query?: never; @@ -59375,6 +61312,26 @@ export interface operations { }; }; }; + list_mcp_user_env_var_status_v1_mcp_user_env_vars_status_get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["MCPUserEnvVarsStatus"][]; + }; + }; + }; + }; list_memory_v1_memory_get: { parameters: { query?: { @@ -59857,6 +61814,26 @@ export interface operations { }; }; }; + create_realtime_transcription_session_v1_realtime_transcription_sessions_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["RealtimeTranscriptionSessionResponse"]; + }; + }; + }; + }; rerank_v1_rerank_post: { parameters: { query?: never; @@ -61767,6 +63744,139 @@ export interface operations { }; }; }; + list_gemini_agents_v1beta_agents_get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + }; + }; + create_gemini_agent_v1beta_agents_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + }; + }; + get_gemini_agent_v1beta_agents__name__get: { + parameters: { + query?: never; + header?: never; + path: { + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + delete_gemini_agent_v1beta_agents__name__delete: { + parameters: { + query?: never; + header?: never; + path: { + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + list_gemini_agent_versions_v1beta_agents__name__versions_get: { + parameters: { + query?: never; + header?: never; + path: { + name: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; create_interaction_v1beta_interactions_post: { parameters: { query?: never; @@ -64023,6 +66133,46 @@ export interface operations { }; }; }; + authorize__mcp_server_name__authorize_get: { + parameters: { + query: { + redirect_uri: string; + client_id?: string | null; + state?: string; + code_challenge?: string | null; + code_challenge_method?: string | null; + response_type?: string | null; + scope?: string | null; + resource?: string | null; + }; + header?: never; + path: { + mcp_server_name: string | null; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; dynamic_mcp_route__mcp_server_name__mcp_get: { parameters: { query?: never; @@ -64240,6 +66390,72 @@ export interface operations { }; }; }; + register_client__mcp_server_name__register_post: { + parameters: { + query?: never; + header?: never; + path: { + mcp_server_name: string | null; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + token_endpoint__mcp_server_name__token_post: { + parameters: { + query?: never; + header?: never; + path: { + mcp_server_name: string | null; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/x-www-form-urlencoded": components["schemas"]["Body_token_endpoint__mcp_server_name__token_post"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; list_batches__provider__v1_batches_get: { parameters: { query?: { From 898ff746731ff8005dc088cdad6f34939bbeb5c4 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Wed, 26 Aug 2026 14:39:51 -0700 Subject: [PATCH 08/14] refactor(proxy): type the snapshot fragments and wrap a long test line --- litellm/proxy/_lazy_openapi_snapshot.py | 11 +++++++++-- .../test_litellm/proxy/test_lazy_openapi_snapshot.py | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/litellm/proxy/_lazy_openapi_snapshot.py b/litellm/proxy/_lazy_openapi_snapshot.py index a895a0809b1..d5b49a473df 100644 --- a/litellm/proxy/_lazy_openapi_snapshot.py +++ b/litellm/proxy/_lazy_openapi_snapshot.py @@ -18,6 +18,8 @@ from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, Final +from typing_extensions import ReadOnly, TypedDict + if TYPE_CHECKING: from fastapi import FastAPI @@ -90,9 +92,14 @@ def _normalize_operation_ids(paths: dict[str, dict]) -> None: break +class SnapshotFragment(TypedDict): + paths: ReadOnly[dict[str, dict[str, object]]] + components: ReadOnly[dict[str, dict[str, object]]] + + @dataclass(frozen=True, slots=True) class SnapshotResult: - fragments: dict[str, dict] + fragments: dict[str, SnapshotFragment] skipped: tuple[str, ...] @@ -115,7 +122,7 @@ def generate_snapshot() -> SnapshotResult: skipped: Final = tuple(name for feat in LAZY_FEATURES if (name := _register_feature(app, feat)) is not None) - fragments: Final[dict[str, dict]] = {} + fragments: Final[dict[str, SnapshotFragment]] = {} used_operation_ids: Final[set[str]] = set() for feat in LAZY_FEATURES: feat_routes = [r for r in app.routes if feat.matches(getattr(r, "path", ""))] diff --git a/tests/test_litellm/proxy/test_lazy_openapi_snapshot.py b/tests/test_litellm/proxy/test_lazy_openapi_snapshot.py index c513bd83b66..f9ef98bc474 100644 --- a/tests/test_litellm/proxy/test_lazy_openapi_snapshot.py +++ b/tests/test_litellm/proxy/test_lazy_openapi_snapshot.py @@ -200,7 +200,10 @@ def test_main_refuses_to_write_a_snapshot_missing_skipped_features(tmp_path, cap def test_main_writes_sorted_snapshot_when_every_feature_loads(tmp_path): snapshot_file = tmp_path / "snapshot.json" - fragments = {"zeta": {"paths": {"/z": {}}, "components": {"schemas": {}}}, "alpha": {"paths": {}, "components": {"schemas": {}}}} + fragments = { + "zeta": {"paths": {"/z": {}}, "components": {"schemas": {}}}, + "alpha": {"paths": {}, "components": {"schemas": {}}}, + } assert main(snapshot_file, generate=lambda: SnapshotResult(fragments=fragments, skipped=())) == 0 assert json.loads(snapshot_file.read_text()) == fragments From e9f3963869e968dea86e919e3c6dfb09b3e72271 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Wed, 26 Aug 2026 14:44:31 -0700 Subject: [PATCH 09/14] refactor(proxy): build snapshot fragments immutably to satisfy the type-discipline gate --- litellm/proxy/_lazy_openapi_snapshot.py | 71 ++++++++++++++----------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/litellm/proxy/_lazy_openapi_snapshot.py b/litellm/proxy/_lazy_openapi_snapshot.py index d5b49a473df..49d277cd3d1 100644 --- a/litellm/proxy/_lazy_openapi_snapshot.py +++ b/litellm/proxy/_lazy_openapi_snapshot.py @@ -13,7 +13,7 @@ the JSON, then run `npm run gen:api` in ui/litellm-dashboard and commit schema.d import json import re import sys -from collections.abc import Callable +from collections.abc import Callable, Mapping from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, Final @@ -93,13 +93,13 @@ def _normalize_operation_ids(paths: dict[str, dict]) -> None: class SnapshotFragment(TypedDict): - paths: ReadOnly[dict[str, dict[str, object]]] - components: ReadOnly[dict[str, dict[str, object]]] + paths: ReadOnly[Mapping[str, Mapping[str, object]]] + components: ReadOnly[Mapping[str, Mapping[str, object]]] @dataclass(frozen=True, slots=True) class SnapshotResult: - fragments: dict[str, SnapshotFragment] + fragments: Mapping[str, SnapshotFragment] skipped: tuple[str, ...] @@ -114,40 +114,47 @@ def _register_feature(app: "FastAPI", feat: "LazyFeature") -> str | None: return None -def generate_snapshot() -> SnapshotResult: +def _feature_fragment(app: "FastAPI", feat: "LazyFeature", used_operation_ids: set[str]) -> SnapshotFragment | None: from fastapi.openapi.utils import get_openapi + from litellm.proxy.proxy_server import ensure_unique_openapi_operation_ids + + feat_routes: Final = [r for r in app.routes if feat.matches(getattr(r, "path", ""))] + if not feat_routes: + return None + _stabilize_multi_method_route_ids(feat_routes) + full: Final = get_openapi(title=app.title, version=app.version, routes=feat_routes) + paths: Final = full.get("paths", {}) + _normalize_operation_ids(paths) + # Group all of a feature's routes under one tag. + for path_ops in paths.values(): + for method, op in path_ops.items(): + if isinstance(op, dict): + operation_id = op.get("operationId") + if isinstance(operation_id, str): + for suffix in HTTP_METHOD_SUFFIXES: + if operation_id.endswith(f"_{suffix}"): + op["operationId"] = operation_id[: -len(suffix)] + method + break + op["tags"] = [feat.name] + unique: Final = ensure_unique_openapi_operation_ids(full, used_operation_ids) + return { + "paths": paths, + "components": {"schemas": unique.get("components", {}).get("schemas", {})}, + } + + +def generate_snapshot() -> SnapshotResult: from litellm.proxy._lazy_features import LAZY_FEATURES - from litellm.proxy.proxy_server import app, ensure_unique_openapi_operation_ids + from litellm.proxy.proxy_server import app skipped: Final = tuple(name for feat in LAZY_FEATURES if (name := _register_feature(app, feat)) is not None) - - fragments: Final[dict[str, SnapshotFragment]] = {} used_operation_ids: Final[set[str]] = set() - for feat in LAZY_FEATURES: - feat_routes = [r for r in app.routes if feat.matches(getattr(r, "path", ""))] - if not feat_routes: - continue - _stabilize_multi_method_route_ids(feat_routes) - full = get_openapi(title=app.title, version=app.version, routes=feat_routes) - paths = full.get("paths", {}) - _normalize_operation_ids(paths) - # Group all of a feature's routes under one tag. - for path_ops in full.get("paths", {}).values(): - for method, op in path_ops.items(): - if isinstance(op, dict): - operation_id = op.get("operationId") - if isinstance(operation_id, str): - for suffix in HTTP_METHOD_SUFFIXES: - if operation_id.endswith(f"_{suffix}"): - op["operationId"] = operation_id[: -len(suffix)] + method - break - op["tags"] = [feat.name] - full = ensure_unique_openapi_operation_ids(full, used_operation_ids) - fragments[feat.name] = { - "paths": paths, - "components": {"schemas": full.get("components", {}).get("schemas", {})}, - } + fragments: Final = { + feat.name: fragment + for feat in LAZY_FEATURES + if (fragment := _feature_fragment(app, feat, used_operation_ids)) is not None + } return SnapshotResult(fragments=fragments, skipped=skipped) From cd63c7e5a7f925268f899c0992d4fc3e6bc79650 Mon Sep 17 00:00:00 2001 From: tin-berri Date: Thu, 27 Aug 2026 00:22:38 -0700 Subject: [PATCH 10/14] feat(ui): put the auto-router savings hero on a spend rail and a four-tile row (#38470) The savings card carried four numbers in two stacked halves: the headline saving with its delta on the left over the two spend rows, and avg saved per session on the right. Give the headline the whole left half, move the two spend rows into a rail on the right, and drop avg saved per session into the metric row below as its first tile, with the session count as an inline hint. Each spend row stays a description list so assistive tech keeps the label to value association, with the shadcn Separator between the two rows. Both hero columns are minmax(0,1fr) so a large total wraps instead of overflowing the card, which also fixes the clipping the old 1fr columns already had. Metric grows one optional hint slot so the new tile reuses the same presenter as its three siblings. --- .../AutoRouterBenchmarksTab.test.tsx | 41 ++++++++++++--- .../_components/AutoRouterBenchmarksTab.tsx | 52 +++++++++++-------- 2 files changed, 62 insertions(+), 31 deletions(-) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/AutoRouterBenchmarksTab.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/AutoRouterBenchmarksTab.test.tsx index 9cc4333b1e8..ce0cd75cd36 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/AutoRouterBenchmarksTab.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/AutoRouterBenchmarksTab.test.tsx @@ -1,5 +1,5 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { fireEvent, render, screen } from "@testing-library/react"; +import { fireEvent, render, screen, within } from "@testing-library/react"; import React from "react"; import { beforeEach, describe, expect, it, vi } from "vitest"; @@ -151,15 +151,18 @@ describe("AutoRouterBenchmarksTab", () => { mockAutoRouters(); }); - it("leads with total estimated savings, before the three session-shape metrics", () => { + it("leads with total estimated savings, before the four session-shape metrics", () => { mockHook({ data: response([group(), group({ router_name: "gpt-auto" })]) }); renderTab(); const labels = screen - .getAllByText(/Total estimated savings|Avg turns per session|Avg session length|Avg tokens per session/) + .getAllByText( + /Total estimated savings|Avg saved per session|Avg turns per session|Avg session length|Avg tokens per session/, + ) .map((node) => node.textContent); expect(labels).toEqual([ "Total estimated savings", + "Avg saved per session", "Avg turns per session", "Avg session length", "Avg tokens per session", @@ -181,13 +184,35 @@ describe("AutoRouterBenchmarksTab", () => { expect(screen.getByText("5.3M")).toBeInTheDocument(); }); - it("pairs the savings with the session count it was earned over", () => { + it("pairs the savings with the session count it was earned over, in its own tile", () => { mockHook({ data: response([group(), group({ router_name: "gpt-auto" })]) }); renderTab(); - expect(screen.getByText("Avg saved per session")).toBeInTheDocument(); - expect(screen.getByText("$23.13")).toBeInTheDocument(); - expect(screen.getByText("across 94 sessions")).toBeInTheDocument(); + const tile = screen.getByText("Avg saved per session").closest('[data-slot="card"]'); + if (!tile) throw new Error("expected avg saved per session to render as a metric tile"); + + expect(within(tile).getByText("$23.13")).toBeInTheDocument(); + expect(within(tile).getByText("· 94 sessions")).toBeInTheDocument(); + }); + + it("exposes each spend row as a term and its value, not as loose text", () => { + mockHook({ data: response([group()]) }); + renderTab(); + + const terms = screen.getAllByRole("term").map((node) => node.textContent); + const values = screen.getAllByRole("definition").map((node) => node.textContent); + expect(terms).toEqual(["Actual auto-router spend", "Estimated spend at highest-tier model"]); + expect(values).toEqual(["$359.86", "$2,534.45"]); + }); + + it("lets both hero columns shrink below their content so a large total cannot clip", () => { + const huge = totals({ saved_spend: 123_456_789_012.34 }); + mockHook({ data: response([group(huge)], huge) }); + renderTab(); + + const figure = screen.getByText("$123,456,789,012.34"); + const grid = figure.closest('[data-slot="card"]')?.firstElementChild; + expect(grid).toHaveClass("md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]"); }); it("shows a cost increase as a positive delta rather than a saving", () => { @@ -315,7 +340,7 @@ describe("AutoRouterBenchmarksTab", () => { expect(screen.getByText("Total estimated savings")).toBeInTheDocument(); expect(screen.getAllByText("$0.00")).toHaveLength(4); - expect(screen.getByText("across 0 sessions")).toBeInTheDocument(); + expect(screen.getByText("· 0 sessions")).toBeInTheDocument(); expect(screen.getByText("0s")).toBeInTheDocument(); expect(screen.getByText(/turns measured/)).toBeInTheDocument(); expect(screen.getAllByText("0.0%").length).toBeGreaterThan(0); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/AutoRouterBenchmarksTab.tsx b/ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/AutoRouterBenchmarksTab.tsx index fda1c1b1155..09a0cf0242b 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/AutoRouterBenchmarksTab.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/cost-optimization/_components/AutoRouterBenchmarksTab.tsx @@ -8,6 +8,7 @@ import AdvancedDatePicker from "@/components/shared/advanced_date_picker"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; +import { Separator } from "@/components/ui/separator"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; @@ -39,51 +40,51 @@ const Message: React.FC<{ children: React.ReactNode }> = ({ children }) => (

{children}

); -const Metric: React.FC<{ label: string; value: string }> = ({ label, value }) => ( +const Metric: React.FC<{ label: string; value: string; hint?: string }> = ({ label, value, hint }) => ( {label} - +

{value}

+ {hint &&

{hint}

}
); +const SpendRow: React.FC<{ label: string; value: string }> = ({ label, value }) => ( +
+
{label}
+
{value}
+
+); + const HeroCard: React.FC<{ view: BenchmarkView }> = ({ view }) => { const stats = view.stats; const cheaper = stats.saved_spend >= 0; return ( -
-
-

Total estimated savings

-
-

{usd(stats.saved_spend)}

+
+
+

+ Total estimated savings +

+
+

{usd(stats.saved_spend)}

{stats.saved_spend !== 0 && (cheaper ? "-" : "+")} {Math.abs(stats.saved_pct).toFixed(0)}%
-
-
-
Actual auto-router spend
-
{usd(stats.spend)}
-
-
-
Estimated spend at highest-tier model
-
{usd(stats.baseline_spend)}
-
-
-
-

Avg saved per session

-

{usd(stats.saved_per_session)}

-

across {stats.sessions.toLocaleString()} sessions

+
+ + +
@@ -239,7 +240,12 @@ const BenchmarksBody: React.FC = ({ isPending, error, data, -
+
+ From 63d7920f8b7a1fcabac463afa4b5791142d42cb2 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2026 08:01:52 +0000 Subject: [PATCH 11/14] refactor: dedupe server_tool_use web search reads and type fresh test locals Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../integrations/dotprompt/prompt_manager.py | 1 - .../llm_cost_calc/tool_call_cost_tracking.py | 24 +++++++++---------- .../litellm_core_utils/llm_cost_calc/utils.py | 10 ++++++++ litellm/llms/anthropic/cost_calculation.py | 4 ++-- .../adapters/transformation.py | 6 ++--- litellm/llms/gemini/cost_calculator.py | 6 +++-- tests/proxy_unit_tests/test_proxy_server.py | 2 +- ...est_tool_call_cost_tracking_dict_safety.py | 2 +- ...erimental_pass_through_messages_handler.py | 9 +++++-- .../test_cost_calculation_dict_safety.py | 6 ++--- 10 files changed, 40 insertions(+), 30 deletions(-) diff --git a/litellm/integrations/dotprompt/prompt_manager.py b/litellm/integrations/dotprompt/prompt_manager.py index a0d5be71392..fd0b17ba746 100644 --- a/litellm/integrations/dotprompt/prompt_manager.py +++ b/litellm/integrations/dotprompt/prompt_manager.py @@ -149,7 +149,6 @@ class PromptManager: ) self.prompts[template_id] = template except Exception: - # Optional: print(f"Error loading prompt from JSON: {template_id}") pass def _load_prompt_file(self, file_path: str | Path, prompt_id: str) -> PromptTemplate: diff --git a/litellm/litellm_core_utils/llm_cost_calc/tool_call_cost_tracking.py b/litellm/litellm_core_utils/llm_cost_calc/tool_call_cost_tracking.py index 9a2c4e244fb..9250b92e268 100644 --- a/litellm/litellm_core_utils/llm_cost_calc/tool_call_cost_tracking.py +++ b/litellm/litellm_core_utils/llm_cost_calc/tool_call_cost_tracking.py @@ -7,7 +7,9 @@ from typing import Any, Final, Literal import litellm from litellm.constants import OPENAI_FILE_SEARCH_COST_PER_1K_CALLS -from litellm.litellm_core_utils.llm_cost_calc.utils import get_web_search_requests +from litellm.litellm_core_utils.llm_cost_calc.utils import ( + get_web_search_requests_from_usage, +) from litellm.types.llms.openai import ( FileSearchTool, ResponsesAPIResponse, @@ -368,7 +370,7 @@ class StandardBuiltInToolCostTracking: get_anthropic_web_search_requests_from_response, ) - if usage is not None and (get_web_search_requests(getattr(usage, "server_tool_use", None)) is not None): + if usage is not None and (get_web_search_requests_from_usage(usage) is not None): return usage web_search_requests: Final = get_anthropic_web_search_requests_from_response(response_object) if web_search_requests is None: @@ -416,7 +418,7 @@ class StandardBuiltInToolCostTracking: # Anthropic Claude (direct API and Vertex AI) uses server_tool_use.web_search_requests. # Without this check, Claude ModelResponse always falls through to return False # and _handle_web_search_cost() is never called. - if hasattr(usage, "server_tool_use") and get_web_search_requests(usage.server_tool_use) is not None: + if get_web_search_requests_from_usage(usage) is not None: return True # xAI reports usage.server_side_tool_usage_details.web_search_calls; a searched # answer with no url_citation annotations has no other chat-path signal @@ -429,16 +431,12 @@ class StandardBuiltInToolCostTracking: response_object=response_object, output_type="web_search_call" ) elif usage is not None: - if ( - hasattr(usage, "server_tool_use") - and get_web_search_requests(usage.server_tool_use) is not None - or ( - hasattr(usage, "prompt_tokens_details") - and usage.prompt_tokens_details is not None - and isinstance(usage.prompt_tokens_details, PromptTokensDetailsWrapper) - and hasattr(usage.prompt_tokens_details, "web_search_requests") - and usage.prompt_tokens_details.web_search_requests is not None - ) + if get_web_search_requests_from_usage(usage) is not None or ( + hasattr(usage, "prompt_tokens_details") + and usage.prompt_tokens_details is not None + and isinstance(usage.prompt_tokens_details, PromptTokensDetailsWrapper) + and hasattr(usage.prompt_tokens_details, "web_search_requests") + and usage.prompt_tokens_details.web_search_requests is not None ): return True if _usage_reports_server_side_web_search_calls(usage): diff --git a/litellm/litellm_core_utils/llm_cost_calc/utils.py b/litellm/litellm_core_utils/llm_cost_calc/utils.py index 9d782cf7a4d..bdbaee00c19 100644 --- a/litellm/litellm_core_utils/llm_cost_calc/utils.py +++ b/litellm/litellm_core_utils/llm_cost_calc/utils.py @@ -92,6 +92,16 @@ def get_web_search_requests(server_tool_use: Any) -> int | None: return getattr(server_tool_use, "web_search_requests", None) +def get_web_search_requests_from_usage(usage: Usage) -> int | None: + """Read ``web_search_requests`` from a ``Usage``'s ``server_tool_use``. + + ``Usage`` deletes unset optional fields from ``__dict__`` (see + ``SafeAttributeModel``), so direct attribute access can raise + ``AttributeError``; ``getattr`` with a default is required here. + """ + return get_web_search_requests(getattr(usage, "server_tool_use", None)) + + def _is_above_128k(tokens: float) -> bool: if tokens > 128000: return True diff --git a/litellm/llms/anthropic/cost_calculation.py b/litellm/llms/anthropic/cost_calculation.py index ec6c480efcc..95615b8e748 100644 --- a/litellm/llms/anthropic/cost_calculation.py +++ b/litellm/llms/anthropic/cost_calculation.py @@ -10,7 +10,7 @@ from pydantic import BaseModel, ValidationError from litellm.litellm_core_utils.llm_cost_calc.utils import ( generic_cost_per_token, get_provider_specific_geo_multiplier, - get_web_search_requests, + get_web_search_requests_from_usage, ) if TYPE_CHECKING: @@ -104,7 +104,7 @@ def get_cost_for_anthropic_web_search( if usage is None: return 0.0 - web_search_requests: Final = get_web_search_requests(getattr(usage, "server_tool_use", None)) + web_search_requests: Final = get_web_search_requests_from_usage(usage) if web_search_requests is None: return 0.0 diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py index d7b527824ea..3597b8c329e 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py @@ -1358,12 +1358,10 @@ class LiteLLMAnthropicMessagesAdapter: @classmethod def _get_web_search_request_count(cls, usage: Usage) -> int: from litellm.litellm_core_utils.llm_cost_calc.utils import ( - get_web_search_requests, + get_web_search_requests_from_usage, ) - from_server_tool_use: Final = cls._positive_int( - get_web_search_requests(getattr(usage, "server_tool_use", None)) - ) + from_server_tool_use: Final = cls._positive_int(get_web_search_requests_from_usage(usage)) if from_server_tool_use > 0: return from_server_tool_use return cls._first_positive_prompt_tokens_detail_value(usage, ("web_search_requests",)) diff --git a/litellm/llms/gemini/cost_calculator.py b/litellm/llms/gemini/cost_calculator.py index 52285af1f5f..b82103b0ff8 100644 --- a/litellm/llms/gemini/cost_calculator.py +++ b/litellm/llms/gemini/cost_calculator.py @@ -39,7 +39,9 @@ def cost_per_web_search_request(usage: "Usage", model_info: "ModelInfo") -> floa ``model_info`` when available, falling back to $0.035 for models not yet updated in the pricing JSON. """ - from litellm.litellm_core_utils.llm_cost_calc.utils import get_web_search_requests + from litellm.litellm_core_utils.llm_cost_calc.utils import ( + get_web_search_requests_from_usage, + ) from litellm.types.utils import PromptTokensDetailsWrapper _DEFAULT_COST: Final = 35e-3 @@ -57,7 +59,7 @@ def cost_per_web_search_request(usage: "Usage", model_info: "ModelInfo") -> floa ) else None ) - requests_from_server_tool_use: Final = get_web_search_requests(getattr(usage, "server_tool_use", None)) + requests_from_server_tool_use: Final = get_web_search_requests_from_usage(usage) number_of_web_search_requests: Final = requests_from_prompt_details or requests_from_server_tool_use or 0 billing_mode: Final = model_info.get("web_search_billing_unit") or "per_prompt" diff --git a/tests/proxy_unit_tests/test_proxy_server.py b/tests/proxy_unit_tests/test_proxy_server.py index 375e1117371..47554913419 100644 --- a/tests/proxy_unit_tests/test_proxy_server.py +++ b/tests/proxy_unit_tests/test_proxy_server.py @@ -2661,7 +2661,7 @@ async def test_run_direct_health_check_drops_only_the_rejected_kwarg(monkeypatch rejected argument alongside working ones would probe deployments the operator opted out.""" import litellm.proxy.proxy_server as proxy_server - seen: list = [] + seen: list[tuple[dict[str, str] | None, bool]] = [] async def fake_perform_health_check( model_list, diff --git a/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_tool_call_cost_tracking_dict_safety.py b/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_tool_call_cost_tracking_dict_safety.py index 3a0a3574539..78bf9292ef5 100644 --- a/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_tool_call_cost_tracking_dict_safety.py +++ b/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_tool_call_cost_tracking_dict_safety.py @@ -10,8 +10,8 @@ import pytest from litellm.litellm_core_utils.llm_cost_calc.tool_call_cost_tracking import ( StandardBuiltInToolCostTracking, - get_web_search_requests, ) +from litellm.litellm_core_utils.llm_cost_calc.utils import get_web_search_requests from litellm.types.utils import ModelResponse, ServerToolUse, Usage diff --git a/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py b/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py index b690b3448ec..5fc4a361e78 100644 --- a/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py +++ b/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py @@ -17,7 +17,12 @@ from litellm.anthropic_interface import messages from litellm.integrations.custom_logger import CustomLogger from litellm.litellm_core_utils.logging_worker import GLOBAL_LOGGING_WORKER from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler -from litellm.types.utils import Delta, ModelResponse, StreamingChoices +from litellm.types.utils import ( + Delta, + ModelResponse, + StandardLoggingPayloadErrorInformation, + StreamingChoices, +) def test_anthropic_experimental_pass_through_messages_handler(): @@ -1292,7 +1297,7 @@ class TestMessagesStreamingSuccessLogging: class _FailureCapture(CustomLogger): def __init__(self): super().__init__() - self.error_information: List[Dict[str, Any]] = [] + self.error_information: list[StandardLoggingPayloadErrorInformation] = [] async def async_log_failure_event(self, kwargs, response_obj, start_time, end_time): payload = kwargs.get("standard_logging_object") or {} diff --git a/tests/test_litellm/llms/anthropic/test_cost_calculation_dict_safety.py b/tests/test_litellm/llms/anthropic/test_cost_calculation_dict_safety.py index 27115ffe241..44b8bb3c9a2 100644 --- a/tests/test_litellm/llms/anthropic/test_cost_calculation_dict_safety.py +++ b/tests/test_litellm/llms/anthropic/test_cost_calculation_dict_safety.py @@ -8,10 +8,8 @@ See https://github.com/BerriAI/litellm/issues/26153. import pytest -from litellm.llms.anthropic.cost_calculation import ( - get_cost_for_anthropic_web_search, - get_web_search_requests, -) +from litellm.litellm_core_utils.llm_cost_calc.utils import get_web_search_requests +from litellm.llms.anthropic.cost_calculation import get_cost_for_anthropic_web_search from litellm.types.utils import ModelInfo, ServerToolUse From ae95acfb056a45da9a4b6d831988d9f05106c6f1 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 27 Aug 2026 02:08:18 -0700 Subject: [PATCH 12/14] fix(exception_mapping_utils): map unmapped exceptions when model and provider are unset --- litellm/litellm_core_utils/exception_mapping_utils.py | 2 +- .../test_exception_mapping_utils.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.py index dc245d42862..70374f87b99 100644 --- a/litellm/litellm_core_utils/exception_mapping_utils.py +++ b/litellm/litellm_core_utils/exception_mapping_utils.py @@ -2341,6 +2341,7 @@ def exception_type( litellm_response_headers: Final = _get_response_headers(original_exception=original_exception) try: error_str = redact_string(str(original_exception)) if _ENABLE_SECRET_REDACTION else str(original_exception) + extra_information = "" if model or custom_llm_provider: if hasattr(original_exception, "message"): error_str = ( @@ -2357,7 +2358,6 @@ def exception_type( # Common Extra information needed for all providers # We pass num retries, api_base, vertex_deployment etc to the exception here ################################################################################ - extra_information = "" try: _api_base: Final = litellm.get_api_base(model=model, optional_params=extra_kwargs) messages: Final = litellm.get_first_chars_messages(kwargs=completion_kwargs) diff --git a/tests/test_litellm/litellm_core_utils/test_exception_mapping_utils.py b/tests/test_litellm/litellm_core_utils/test_exception_mapping_utils.py index 895044c8ad5..8e89180a9e4 100644 --- a/tests/test_litellm/litellm_core_utils/test_exception_mapping_utils.py +++ b/tests/test_litellm/litellm_core_utils/test_exception_mapping_utils.py @@ -1002,6 +1002,17 @@ def test_an_exception_without_a_status_is_still_a_connection_error(quiet_excepti ) +def test_an_unmapped_exception_with_no_model_or_provider_is_a_connection_error(quiet_exception_mapping): + with pytest.raises(litellm.APIConnectionError) as raised: + exception_type( + model=None, + original_exception=ValueError("boom"), + custom_llm_provider=None, + ) + + assert "boom" in raised.value.message + + CONTEXT_WINDOW_MESSAGE = "This model's maximum context length is 4096 tokens." CONTENT_POLICY_MESSAGE = ( '{"error": {"type": "invalid_request_error", "code": "content_policy_violation"}}' From 02dcc4d3470487edd997bcc6ae378d8761d5f4d7 Mon Sep 17 00:00:00 2001 From: Imran Ismail Date: Fri, 28 Aug 2026 05:26:45 +1200 Subject: [PATCH 13/14] fix(ui_sso): resolve highest privilege Entra app role, not first in claim (#36728) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(ui_sso): resolve highest privilege Entra app role, not first in claim A user assigned more than one Entra app role — commonly by belonging to several assigned groups — arrives at the Microsoft SSO callback with every role in the id_token `roles` claim. LiteLLM stores a single role per user, and get_microsoft_callback_response collapsed the list by taking the first value that resolved to a LitellmUserRoles and breaking. Entra does not guarantee the ordering of the `roles` claim, so which role won was effectively arbitrary: a user in one group mapped to internal_user and another mapped to proxy_admin_viewer could be silently demoted to internal_user, and proxy_admin could lose to either. The generic/Okta path already resolves this correctly via determine_role_from_groups, which walks a documented privilege hierarchy. Hoist that hierarchy into LITELLM_USER_ROLE_HIERARCHY and reuse it, so app-role logins and group-mapping logins agree. Extract the selection into MicrosoftSSOHandler.get_user_role_from_app_roles so it is directly testable — the existing tests re-implemented the loop inline, which is why the ordering bug was not caught. Behaviour is unchanged for single-role claims, unrecognised values, and empty claims. Roles the hierarchy does not rank (org_admin, team, customer) are resolved deterministically rather than by claim order. * refactor(ui_sso): trim role selection prose and use immutable annotations Addresses review feedback on the app role selection helper. Drop the explanatory comments and the Args/Returns docstring boilerplate that restated the control flow, keeping only the part a reader cannot infer from the code: that Entra does not guarantee claim ordering, and how unranked roles resolve. Type the parameter as Sequence[str] rather than list[str] and build the resolved set as a frozenset, so the helper stops adding an LIT001 mutable-collection annotation. Make LITELLM_USER_ROLE_HIERARCHY a tuple for the same reason. No behaviour change: the ordering regression tests still fail against the previous first-match-wins logic and pass here. --- litellm/proxy/management_endpoints/ui_sso.py | 50 ++++-- .../test_entraid_app_roles.py | 161 +++++++++++------- 2 files changed, 127 insertions(+), 84 deletions(-) diff --git a/litellm/proxy/management_endpoints/ui_sso.py b/litellm/proxy/management_endpoints/ui_sso.py index 0c8240b3298..613508da22b 100644 --- a/litellm/proxy/management_endpoints/ui_sso.py +++ b/litellm/proxy/management_endpoints/ui_sso.py @@ -808,6 +808,15 @@ def normalize_email(email: str | None) -> str | None: return email.lower() if isinstance(email, str) else email +# Ordered highest to lowest privilege +LITELLM_USER_ROLE_HIERARCHY: Final = ( + LitellmUserRoles.PROXY_ADMIN, + LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY, + LitellmUserRoles.INTERNAL_USER, + LitellmUserRoles.INTERNAL_USER_VIEW_ONLY, +) + + def determine_role_from_groups( user_groups: list[str], role_mappings: "RoleMappings", @@ -832,19 +841,11 @@ def determine_role_from_groups( # No role mappings configured, return default_role return role_mappings.default_role - # Role hierarchy (highest to lowest) - role_hierarchy: Final = [ - LitellmUserRoles.PROXY_ADMIN, - LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY, - LitellmUserRoles.INTERNAL_USER, - LitellmUserRoles.INTERNAL_USER_VIEW_ONLY, - ] - # Convert user_groups to a set for efficient lookup user_groups_set: Final = set(user_groups) if isinstance(user_groups, list) else set() # Find the highest privilege role the user belongs to - for role in role_hierarchy: + for role in LITELLM_USER_ROLE_HIERARCHY: if role in role_mappings.roles: role_groups = role_mappings.roles[role] if isinstance(role_groups, list) and user_groups_set.intersection(set(role_groups)): @@ -4236,15 +4237,7 @@ class MicrosoftSSOHandler: verbose_proxy_logger.debug("Extracted app roles from id_token: %s", app_roles) # Combine groups and app roles - user_role: LitellmUserRoles | None = None - if app_roles: - # Check if any app role is a valid LitellmUserRoles - for role_str in app_roles: - role = get_litellm_user_role(role_str) - if role is not None: - user_role = role - verbose_proxy_logger.debug("Found valid LitellmUserRoles '%s' in app_roles", role.value) - break + user_role: Final = MicrosoftSSOHandler.get_user_role_from_app_roles(app_roles) verbose_proxy_logger.debug("Combined team_ids (groups + app roles): %s", user_team_ids) @@ -4282,6 +4275,27 @@ class MicrosoftSSOHandler: verbose_proxy_logger.debug("Microsoft SSO OpenID Response: %s", openid_response) return openid_response + @staticmethod + def get_user_role_from_app_roles( + app_roles: Sequence[str] | None, + ) -> LitellmUserRoles | None: + """ + Resolve the one role LiteLLM stores for a user from their Entra app roles. + + Entra does not guarantee `roles` claim ordering, so a user holding several app + roles resolves to the highest privilege one rather than whichever the claim + listed first. Roles the hierarchy does not rank (org_admin, team, customer) + resolve by name to stay deterministic + """ + resolved: Final = frozenset( + role for role in (get_litellm_user_role(role_str) for role_str in app_roles or ()) if role is not None + ) + if not resolved: + return None + + ranked: Final = next((role for role in LITELLM_USER_ROLE_HIERARCHY if role in resolved), None) + return ranked if ranked is not None else min(resolved, key=lambda role: role.value) + @staticmethod def get_app_roles_from_id_token(id_token: str | None) -> list[str]: """ diff --git a/tests/test_litellm/proxy/management_endpoints/test_entraid_app_roles.py b/tests/test_litellm/proxy/management_endpoints/test_entraid_app_roles.py index 2ce36b73de0..0c3fe175b48 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_entraid_app_roles.py +++ b/tests/test_litellm/proxy/management_endpoints/test_entraid_app_roles.py @@ -1,91 +1,120 @@ import jwt +import pytest -from litellm.proxy.management_endpoints.ui_sso import MicrosoftSSOHandler -from litellm.proxy.management_endpoints.types import get_litellm_user_role from litellm.proxy._types import LitellmUserRoles +from litellm.proxy.management_endpoints.ui_sso import MicrosoftSSOHandler + + +def _id_token(**claims) -> str: + """Build a signed id_token carrying the given claims.""" + payload = { + "sub": "user123", + "email": "user@company.com", + "aud": "litellm-app", + "iss": "https://login.microsoftonline.com/tenant-id/v2.0", + "exp": 9999999999, + **claims, + } + return jwt.encode(payload, "secret", algorithm="HS256") def test_extracts_proxy_admin_role_from_jwt(): """Ensure supported app roles like 'proxy_admin' are extracted from the id_token.""" - payload = { - "sub": "user123", - "email": "admin@company.com", - "app_roles": ["proxy_admin"], - "aud": "litellm-app", - "iss": "https://login.microsoftonline.com/tenant-id/v2.0", - "exp": 9999999999, - } + token = _id_token(app_roles=["proxy_admin"]) - token = jwt.encode(payload, "secret", algorithm="HS256") roles = MicrosoftSSOHandler.get_app_roles_from_id_token(token) assert roles == ["proxy_admin"] -def test_maps_internal_user_role(): - """Ensure internal_user role is correctly mapped to LitellmUserRoles.""" - payload = { - "sub": "user456", - "email": "user@company.com", - "app_roles": ["internal_user"], - "aud": "litellm-app", - "iss": "https://login.microsoftonline.com/tenant-id/v2.0", - "exp": 9999999999, - } +def test_extracts_app_roles_from_roles_claim(): + """Entra emits app role values in the `roles` claim; both spellings are read.""" + token = _id_token(roles=["internal_user"]) - token = jwt.encode(payload, "secret", algorithm="HS256") roles = MicrosoftSSOHandler.get_app_roles_from_id_token(token) - # Map to LitellmUserRoles - chosen = None - for r in roles: - mapped = get_litellm_user_role(r) - if mapped is not None: - chosen = mapped - break - - assert chosen == LitellmUserRoles.INTERNAL_USER + assert roles == ["internal_user"] -def test_maps_proxy_admin_viewer_role(): - """Ensure proxy_admin_viewer role is correctly mapped.""" - payload = { - "sub": "user789", - "email": "viewer@company.com", - "app_roles": ["proxy_admin_viewer"], - "aud": "litellm-app", - "iss": "https://login.microsoftonline.com/tenant-id/v2.0", - "exp": 9999999999, - } - - token = jwt.encode(payload, "secret", algorithm="HS256") - roles = MicrosoftSSOHandler.get_app_roles_from_id_token(token) - - chosen = None - for r in roles: - mapped = get_litellm_user_role(r) - if mapped is not None: - chosen = mapped - break - - assert chosen == LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY +@pytest.mark.parametrize( + "app_roles, expected", + [ + (["proxy_admin"], LitellmUserRoles.PROXY_ADMIN), + (["proxy_admin_viewer"], LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY), + (["internal_user"], LitellmUserRoles.INTERNAL_USER), + (["internal_user_viewer"], LitellmUserRoles.INTERNAL_USER_VIEW_ONLY), + # Case-insensitive, matching get_litellm_user_role. + (["PROXY_ADMIN_VIEWER"], LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY), + # Roles outside the privilege hierarchy still resolve. + (["org_admin"], LitellmUserRoles.ORG_ADMIN), + ], +) +def test_maps_single_app_role(app_roles, expected): + """A lone app role maps to its LitellmUserRoles equivalent.""" + assert MicrosoftSSOHandler.get_user_role_from_app_roles(app_roles) == expected -def test_defaults_to_internal_user_viewer_when_no_role(): - """Ensure default role is internal_user_viewer when no app role is present.""" - payload = { - "sub": "user_no_role", - "email": "noRole@company.com", - "aud": "litellm-app", - "iss": "https://login.microsoftonline.com/tenant-id/v2.0", - "exp": 9999999999, - } +@pytest.mark.parametrize( + "app_roles", + [ + ["internal_user", "proxy_admin_viewer"], + ["proxy_admin_viewer", "internal_user"], + ], +) +def test_highest_privilege_role_wins_regardless_of_claim_order(app_roles): + """ + A user in one group mapped to `internal_user` and another mapped to + `proxy_admin_viewer` gets the higher privilege role either way. + + Entra does not guarantee the ordering of the `roles` claim, so the resolved + role must not depend on it. + """ + assert MicrosoftSSOHandler.get_user_role_from_app_roles(app_roles) == (LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY) + + +@pytest.mark.parametrize( + "app_roles", + [ + ["internal_user", "proxy_admin_viewer", "proxy_admin"], + ["proxy_admin", "proxy_admin_viewer", "internal_user"], + ["proxy_admin_viewer", "internal_user", "proxy_admin"], + ], +) +def test_proxy_admin_beats_every_other_role(app_roles): + """proxy_admin outranks every other role in the hierarchy, in any claim order.""" + assert MicrosoftSSOHandler.get_user_role_from_app_roles(app_roles) == LitellmUserRoles.PROXY_ADMIN + + +def test_unrecognised_app_roles_are_ignored(): + """App roles that are not LitellmUserRoles values do not shadow ones that are.""" + app_roles = ["Some.Custom.Role", "msiam_access", "internal_user"] + + assert MicrosoftSSOHandler.get_user_role_from_app_roles(app_roles) == LitellmUserRoles.INTERNAL_USER + + +@pytest.mark.parametrize("app_roles", [None, [], ["msiam_access"], ["User"]]) +def test_returns_none_when_no_role_resolves(app_roles): + """ + Returning None lets the caller keep the user's stored role or apply + default_internal_user_params, rather than forcing a role. + """ + assert MicrosoftSSOHandler.get_user_role_from_app_roles(app_roles) is None + + +def test_no_role_claim_yields_no_app_roles(): + """An id_token with no role claim produces no app roles, and so no role.""" + token = _id_token() - token = jwt.encode(payload, "secret", algorithm="HS256") roles = MicrosoftSSOHandler.get_app_roles_from_id_token(token) assert roles == [] + assert MicrosoftSSOHandler.get_user_role_from_app_roles(roles) is None - # Default role would be internal_user_viewer - default_role = LitellmUserRoles.INTERNAL_USER_VIEW_ONLY - assert default_role.value == "internal_user_viewer" + +def test_end_to_end_from_id_token_to_role(): + """The id_token -> role path resolves the highest privilege role.""" + token = _id_token(roles=["internal_user", "proxy_admin_viewer"]) + + roles = MicrosoftSSOHandler.get_app_roles_from_id_token(token) + + assert MicrosoftSSOHandler.get_user_role_from_app_roles(roles) == LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY From a7da7928fa2fa4d480114e8398482b7edca00303 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2026 17:57:07 +0000 Subject: [PATCH 14/14] feat(ui): add cache hit/miss filter to Request Logs (#38432) * feat(ui): add cache hit/miss filter to Request Logs Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: guard cache_hit_filter validation for direct handler calls Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * chore(ui): drop redundant cache filter comment Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: yassin Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../spend_management_endpoints.py | 16 ++++ .../test_spend_management_endpoints.py | 94 +++++++++++++++++++ .../src/components/networking.tsx | 1 + .../view_logs/RequestLogsFilters.test.tsx | 34 +++++++ .../view_logs/RequestLogsFilters.tsx | 27 ++++++ .../view_logs/log_filter_logic.test.tsx | 2 + .../components/view_logs/log_filter_logic.tsx | 3 + ui/litellm-dashboard/src/lib/http/schema.d.ts | 4 + 8 files changed, 181 insertions(+) diff --git a/litellm/proxy/spend_tracking/spend_management_endpoints.py b/litellm/proxy/spend_tracking/spend_management_endpoints.py index ee90ffbee79..1c49ad51beb 100644 --- a/litellm/proxy/spend_tracking/spend_management_endpoints.py +++ b/litellm/proxy/spend_tracking/spend_management_endpoints.py @@ -2254,6 +2254,10 @@ async def ui_view_spend_logs( status_filter: str | None = fastapi.Query( default=None, description="Filter logs by status (e.g., success, failure)" ), + cache_hit_filter: str | None = fastapi.Query( + default=None, + description="Filter logs by cache state: 'hit' or 'miss'. Miss includes legacy rows with a null/unknown cache state", + ), model: str | None = fastapi.Query(default=None, description="Filter logs by model"), model_id: str | None = fastapi.Query( default=None, @@ -2330,6 +2334,13 @@ async def ui_view_spend_logs( param="sort_order", code=status.HTTP_400_BAD_REQUEST, ) + if isinstance(cache_hit_filter, str) and cache_hit_filter not in {"hit", "miss"}: + raise ProxyException( + message=f"Invalid cache_hit_filter: {cache_hit_filter}. Must be one of: hit, miss", + type="bad_request", + param="cache_hit_filter", + code=status.HTTP_400_BAD_REQUEST, + ) try: is_admin_view: Final = _is_admin_view_safe(user_api_key_dict=user_api_key_dict) @@ -2570,6 +2581,11 @@ async def ui_view_spend_logs( sql_params.append(status_filter) p += 1 + if cache_hit_filter == "hit": + sql_conditions.append("LOWER(cache_hit) = 'true'") + elif cache_hit_filter == "miss": + sql_conditions.append("(cache_hit IS NULL OR LOWER(cache_hit) != 'true')") + if exclude_internal_health_checks: sql_conditions.append(f"api_key NOT IN (${p}, ${p + 1})") sql_params.extend(_INTERNAL_HEALTH_CHECK_API_KEYS) diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py b/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py index a378d99d049..19ceb3d3d1f 100644 --- a/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py +++ b/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py @@ -106,6 +106,10 @@ def _reconstruct_ui_where_from_sql(sql_query, params): where["OR"] = where.get("OR", []) + [{"multi_team": True}] elif "status = 'success'" in cond: where["OR"] = where.get("OR", []) + [{"status": "success"}] + elif cond == "LOWER(cache_hit) = 'true'": + where["cache_hit"] = "hit" + elif cond == "(cache_hit IS NULL OR LOWER(cache_hit) != 'true')": + where["cache_hit"] = "miss" elif sess: where["session_id"] = {"contains": str(params[int(sess.group(1)) - 1]).strip("%")} elif status: @@ -2444,6 +2448,96 @@ async def test_ui_view_spend_logs_with_status(client, monkeypatch): app.dependency_overrides.pop(ps.user_api_key_auth, None) +@pytest.mark.asyncio +async def test_ui_view_spend_logs_with_cache_hit_filter(client, monkeypatch): + base = { + "api_key": "sk-test-key", + "user": "test_user_1", + "team_id": "team1", + "spend": 0.05, + "startTime": datetime.datetime.now(timezone.utc).isoformat(), + "model": "gpt-4", + "status": "success", + } + mock_spend_logs = [ + {**base, "id": "log1", "request_id": "req-hit", "cache_hit": "True"}, + {**base, "id": "log2", "request_id": "req-miss", "cache_hit": "False"}, + {**base, "id": "log3", "request_id": "req-legacy", "cache_hit": "None"}, + {**base, "id": "log4", "request_id": "req-null", "cache_hit": None}, + ] + + def filter_by_cache(where): + cache_filter = where.get("cache_hit") + if cache_filter == "hit": + return [log for log in mock_spend_logs if str(log["cache_hit"]).lower() == "true"] + if cache_filter == "miss": + return [log for log in mock_spend_logs if str(log["cache_hit"]).lower() != "true"] + return mock_spend_logs + + monkeypatch.setattr( + "litellm.proxy.proxy_server.prisma_client", + make_ui_spend_logs_mock_prisma(mock_spend_logs, filter_by_cache), + ) + + start_date, end_date = _default_date_range() + + app.dependency_overrides[ps.user_api_key_auth] = lambda: UserAPIKeyAuth( + user_role=LitellmUserRoles.PROXY_ADMIN + ) + try: + response = client.get( + "/spend/logs/ui", + params={ + "cache_hit_filter": "hit", + "start_date": start_date, + "end_date": end_date, + }, + headers={"Authorization": "Bearer sk-test"}, + ) + assert response.status_code == 200 + data = response.json() + assert data["total"] == 1 + assert [row["request_id"] for row in data["data"]] == ["req-hit"] + + response = client.get( + "/spend/logs/ui", + params={ + "cache_hit_filter": "miss", + "start_date": start_date, + "end_date": end_date, + }, + headers={"Authorization": "Bearer sk-test"}, + ) + assert response.status_code == 200 + data = response.json() + assert data["total"] == 3 + assert [row["request_id"] for row in data["data"]] == ["req-miss", "req-legacy", "req-null"] + + response = client.get( + "/spend/logs/ui", + params={ + "start_date": start_date, + "end_date": end_date, + }, + headers={"Authorization": "Bearer sk-test"}, + ) + assert response.status_code == 200 + assert response.json()["total"] == 4 + + response = client.get( + "/spend/logs/ui", + params={ + "cache_hit_filter": "invalid", + "start_date": start_date, + "end_date": end_date, + }, + headers={"Authorization": "Bearer sk-test"}, + ) + assert response.status_code == 400 + finally: + app.dependency_overrides.pop(ps.user_api_key_auth, None) + + @pytest.mark.asyncio async def test_ui_view_spend_logs_with_model(client, monkeypatch): mock_spend_logs = [ diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx index c7868a5f039..032429ba8ed 100644 --- a/ui/litellm-dashboard/src/components/networking.tsx +++ b/ui/litellm-dashboard/src/components/networking.tsx @@ -2002,6 +2002,7 @@ interface UiSpendLogsParams { user_id?: string; end_user?: string; status_filter?: string; + cache_hit_filter?: string; /** Filter by model name (e.g. "gpt-4") */ model?: string; /** Filter by model ID (litellm model deployment id) */ diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.test.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.test.tsx index 893d6219e64..5d96f2637cd 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.test.tsx @@ -69,6 +69,7 @@ describe("RequestLogsFilters", () => { for (const label of [ "Team ID", "Status", + "Cache", "Key Alias", "User ID", "End User", @@ -259,4 +260,37 @@ describe("RequestLogsFilters", () => { expect(await screen.findByText(label)).toBeInTheDocument(); }); + + it.each([ + ["", "All Requests"], + ["hit", "Cache Hit"], + ["miss", "Cache Miss"], + ])("shows the human label on the Cache trigger for %s", async (cacheState, label) => { + renderFilters(cacheState === "" ? {} : { [LOG_FILTER_IDS.CACHE_STATUS]: cacheState }); + + expect(await screen.findByText(label)).toBeInTheDocument(); + }); + + it.each([ + ["Cache Hit", "hit"], + ["Cache Miss", "miss"], + ])("selecting %s sets the cache filter to %s", async (label, expected) => { + const user = userEvent.setup(); + const { set } = renderFilters(); + + await user.click(await screen.findByText("All Requests")); + await user.click(await screen.findByRole("option", { name: label })); + + expect(set).toHaveBeenCalledWith(LOG_FILTER_IDS.CACHE_STATUS, expected); + }); + + it("selecting All Requests clears the cache filter", async () => { + const user = userEvent.setup(); + const { set } = renderFilters({ [LOG_FILTER_IDS.CACHE_STATUS]: "hit" }); + + await user.click(await screen.findByText("Cache Hit")); + await user.click(await screen.findByRole("option", { name: "All Requests" })); + + expect(set).toHaveBeenCalledWith(LOG_FILTER_IDS.CACHE_STATUS, undefined); + }); }); diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.tsx index af6a6d1f178..69257a6f52d 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsFilters.tsx @@ -31,6 +31,12 @@ const STATUS_FILTER_ITEMS = [ { value: "success", label: "Success" }, { value: "failure", label: "Failure" }, ] as const; + +const CACHE_FILTER_ITEMS = [ + { value: ALL_VALUE, label: "All Requests" }, + { value: "hit", label: "Cache Hit" }, + { value: "miss", label: "Cache Miss" }, +] as const; const PAGE_SIZE = 50; const asString = (value: unknown): string => (typeof value === "string" ? value : ""); @@ -328,6 +334,27 @@ export function RequestLogsFilters({ get, set, teams, logsWindow }: RequestLogsF + + + + { { id: LOG_FILTER_IDS.SESSION_ID, value: "sess-1", param: "session_id" }, { id: LOG_FILTER_IDS.END_USER, value: "end-user-1", param: "end_user" }, { id: LOG_FILTER_IDS.STATUS, value: "failure", param: "status_filter" }, + { id: LOG_FILTER_IDS.CACHE_STATUS, value: "hit", param: "cache_hit_filter" }, + { id: LOG_FILTER_IDS.CACHE_STATUS, value: "miss", param: "cache_hit_filter" }, { id: LOG_FILTER_IDS.MODEL_ID, value: "model-uuid-1", param: "model_id" }, { id: LOG_FILTER_IDS.PUBLIC_MODEL_OR_SEARCH_TOOL, value: "gpt-4o", param: "model" }, { id: LOG_FILTER_IDS.KEY_ALIAS, value: "alias-1", param: "key_alias" }, diff --git a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx index 9b6666dc9ee..3b8d96596de 100644 --- a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx @@ -20,6 +20,7 @@ export interface PaginatedResponse { export const LOG_FILTER_IDS = { TEAM_ID: "team_id", STATUS: "status", + CACHE_STATUS: "cache_hit", KEY_ALIAS: "key_alias", END_USER: "end_user", ERROR_CODE: "error_code", @@ -35,6 +36,7 @@ export const LOG_FILTER_IDS = { export const LOG_FILTER_LABELS: Record = { [LOG_FILTER_IDS.TEAM_ID]: "Team ID", [LOG_FILTER_IDS.STATUS]: "Status", + [LOG_FILTER_IDS.CACHE_STATUS]: "Cache", [LOG_FILTER_IDS.KEY_ALIAS]: "Key Alias", [LOG_FILTER_IDS.USER_ID]: "User ID", [LOG_FILTER_IDS.END_USER]: "End User", @@ -170,6 +172,7 @@ export function useLogFilterLogic({ user_id: userIdFilter, end_user: getFilterValue(columnFilters, LOG_FILTER_IDS.END_USER), status_filter: getFilterValue(columnFilters, LOG_FILTER_IDS.STATUS), + cache_hit_filter: getFilterValue(columnFilters, LOG_FILTER_IDS.CACHE_STATUS), model_id: getFilterValue(columnFilters, LOG_FILTER_IDS.MODEL_ID), model: getFilterValue(columnFilters, LOG_FILTER_IDS.PUBLIC_MODEL_OR_SEARCH_TOOL), key_alias: getFilterValue(columnFilters, LOG_FILTER_IDS.KEY_ALIAS), diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.ts index 3afa111d65b..9ac49fa96e1 100644 --- a/ui/litellm-dashboard/src/lib/http/schema.d.ts +++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts @@ -55030,6 +55030,8 @@ export interface operations { page_size?: number; /** @description Filter logs by status (e.g., success, failure) */ status_filter?: string | null; + /** @description Filter logs by cache state: 'hit' or 'miss'. Miss includes legacy rows with a null/unknown cache state */ + cache_hit_filter?: string | null; /** @description Filter logs by model */ model?: string | null; /** @description Filter logs by model ID (litellm model deployment id) */ @@ -55140,6 +55142,8 @@ export interface operations { page_size?: number; /** @description Filter logs by status (e.g., success, failure) */ status_filter?: string | null; + /** @description Filter logs by cache state: 'hit' or 'miss'. Miss includes legacy rows with a null/unknown cache state */ + cache_hit_filter?: string | null; /** @description Filter logs by model */ model?: string | null; /** @description Filter logs by model ID (litellm model deployment id) */