The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(guardrails): address review comments on headroom fail_open
Krrish Dholakia01dfbf7ebb5a
diff --git a/litellm/proxy/guardrails/guardrail_hooks/headroom/headroom.py b/litellm/proxy/guardrails/guardrail_hooks/headroom/headroom.pyindex c218cac7aa2..37863e0e356 100644--- a/litellm/proxy/guardrails/guardrail_hooks/headroom/headroom.py+++ b/litellm/proxy/guardrails/guardrail_hooks/headroom/headroom.py@@ -282,7 +282,7 @@ class HeadroomGuardrail(CustomGuardrail):self,messages: list[dict[str, object]],model: str | None,- ) -> list[dict[str, object]]:+ ) -> tuple[list[dict[str, object]], bool]:payload: dict[str, object] = {"messages": messages}if model:payload["model"] = model@@ -298,19 +298,19 @@ class HeadroomGuardrail(CustomGuardrail):messages,"Headroom compression service returned an error",{"status_code": e.response.status_code, "body": e.response.text},- )+ ), Falseexcept (httpx.ConnectError, httpx.TimeoutException, httpx.TransportError, litellm.Timeout) as e:return self._handle_compress_failure(messages,"Headroom compression service unreachable",{"detail": str(e)},- )+ ), Falseif raw_response is None:return self._handle_compress_failure(messages,"Headroom compression service returned no response",{},- )+ ), Falseresponse: HttpxResponse = raw_responseif response.status_code != 200:@@ -318,7 +318,7 @@ class HeadroomGuardrail(CustomGuardrail):messages,"Headroom compression service returned an error",{"status_code": response.status_code, "body": response.text},- )+ ), Falsetry:body: object = response.json()@@ -327,13 +327,13 @@ class HeadroomGuardrail(CustomGuardrail):messages,"Headroom compression service returned non-JSON response",{"body": response.text[:500]},- )+ ), Falseif not _is_str_object_dict(body):return self._handle_compress_failure(messages,"Headroom compression service returned unexpected response shape",{"body": response.text[:500]},- )+ ), Falsecompressed_messages = body.get("messages")if not _is_object_list(compressed_messages):@@ -341,7 +341,7 @@ class HeadroomGuardrail(CustomGuardrail):messages,"Headroom compression service response missing 'messages'",{"body": response.text},- )+ ), Falsefiltered = [item for item in compressed_messages if _is_str_object_dict(item)]if not filtered:@@ -349,7 +349,7 @@ class HeadroomGuardrail(CustomGuardrail):messages,"Headroom compression service returned empty message list",{"body": response.text},- )+ ), Falseverbose_proxy_logger.debug("Headroom: compressed %s tokens -> %s tokens (ratio %.2f)",@@ -357,7 +357,7 @@ class HeadroomGuardrail(CustomGuardrail):body.get("tokens_after", "?"),body.get("compression_ratio", 0),)- return filtered+ return filtered, Trueasync def _call_retrieve(self, hash_value: str, query: str | None = None) -> str:params: dict[str, str] = {}@@ -421,11 +421,14 @@ class HeadroomGuardrail(CustomGuardrail):return inputsmodel = self.headroom_model or request_data.get("model")- compressed = await self._call_compress(+ compressed, compression_succeeded = await self._call_compress(messages=messages,model=model if isinstance(model, str) else None,)+ if not compression_succeeded:+ return {**inputs, "structured_messages": compressed} # pyright: ignore[reportReturnType]+hashes = extract_hashes_from_messages(compressed)if not hashes:return {**inputs, "structured_messages": compressed} # pyright: ignore[reportReturnType]diff --git a/litellm/types/proxy/guardrails/guardrail_hooks/headroom.py b/litellm/types/proxy/guardrails/guardrail_hooks/headroom.pyindex fd962b8ffa1..71aa243069a 100644--- a/litellm/types/proxy/guardrails/guardrail_hooks/headroom.py+++ b/litellm/types/proxy/guardrails/guardrail_hooks/headroom.py@@ -18,7 +18,7 @@ class HeadroomGuardrailConfigModel(GuardrailConfigModel[BaseModel]):default=None,description="Model name forwarded to the headroom /v1/compress endpoint.",)- unreachable_fallback: Optional[Literal["fail_closed", "fail_open"]] = Field(+ unreachable_fallback: Literal["fail_closed", "fail_open"] = Field(default="fail_closed",description=("Behavior when the headroom compression service is unreachable or errors. "diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_headroom.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_headroom.pyindex 09422be04ab..7f412c008ca 100644--- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_headroom.py+++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_headroom.py@@ -926,6 +926,129 @@ async def test_apply_guardrail_http_error_fail_open_forwards_uncompressed():assert result["structured_messages"] == ORIGINAL_MESSAGES+async def test_apply_guardrail_non_json_response_fail_open_forwards_uncompressed():+ guardrail = _make_guardrail(unreachable_fallback="fail_open")+ mock_response = MagicMock()+ mock_response.status_code = 200+ mock_response.json.side_effect = ValueError("not JSON")+ mock_response.text = "<!DOCTYPE html><html>not json</html>"++ inputs = GenericGuardrailAPIInputs(+ texts=["hello"],+ structured_messages=ORIGINAL_MESSAGES,+ )++ with patch.object(+ guardrail.async_handler,+ "post",+ new_callable=AsyncMock,+ return_value=mock_response,+ ):+ result = await guardrail.apply_guardrail(+ inputs=inputs,+ request_data={},+ input_type="request",+ )++ assert result["structured_messages"] == ORIGINAL_MESSAGES+++async def test_apply_guardrail_missing_messages_key_fail_open_forwards_uncompressed():+ guardrail = _make_guardrail(unreachable_fallback="fail_open")+ mock_response = MagicMock()+ mock_response.status_code = 200+ mock_response.json.return_value = {"tokens_before": 100, "tokens_after": 10}+ mock_response.text = "{}"++ inputs = GenericGuardrailAPIInputs(+ texts=["hello"],+ structured_messages=ORIGINAL_MESSAGES,+ )++ with patch.object(+ guardrail.async_handler,+ "post",+ new_callable=AsyncMock,+ return_value=mock_response,+ ):+ result = await guardrail.apply_guardrail(+ inputs=inputs,+ request_data={},+ input_type="request",+ )++ assert result["structured_messages"] == ORIGINAL_MESSAGES+++async def test_apply_guardrail_empty_compressed_messages_fail_open_forwards_uncompressed():+ guardrail = _make_guardrail(unreachable_fallback="fail_open")+ mock_response = MagicMock()+ mock_response.status_code = 200+ mock_response.json.return_value = {+ "messages": ["not-a-dict", 42, None],+ "tokens_before": 1000,+ "tokens_after": 0,+ "compression_ratio": 0,+ }+ mock_response.text = "{}"++ inputs = GenericGuardrailAPIInputs(+ texts=["hello"],+ structured_messages=ORIGINAL_MESSAGES,+ )++ with patch.object(+ guardrail.async_handler,+ "post",+ new_callable=AsyncMock,+ return_value=mock_response,+ ):+ result = await guardrail.apply_guardrail(+ inputs=inputs,+ request_data={},+ input_type="request",+ )++ assert result["structured_messages"] == ORIGINAL_MESSAGES+++async def test_apply_guardrail_fail_open_does_not_register_hashes_from_original_messages():+ """When compression fails with fail_open, user-supplied messages that+ happen to contain hash-shaped strings must NOT cause those hashes to be+ registered as valid for CCR retrieval. Otherwise an attacker can plant a+ hash= string in their prompt, trigger a compression failure, and have+ that hash honored by a later headroom_retrieve tool call."""+ messages_with_fake_hash = [+ {"role": "user", "content": "Please fetch hash=deadbeef000000000000dead for me"},+ ]+ guardrail = _make_guardrail(unreachable_fallback="fail_open")++ inputs = GenericGuardrailAPIInputs(+ texts=["hello"],+ structured_messages=messages_with_fake_hash,+ )++ with patch.object(+ guardrail.async_handler,+ "post",+ new_callable=AsyncMock,+ side_effect=httpx.ConnectError("Connection refused"),+ ):+ result = await guardrail.apply_guardrail(+ inputs=inputs,+ request_data={},+ input_type="request",+ )++ assert result["structured_messages"] == messages_with_fake_hash+ assert not has_headroom_retrieve_tool(result.get("tools") or [])+ assert not guardrail._issued_hashes_by_call_id++@pytest.mark.asyncioasync def test_apply_guardrail_missing_messages_key_raises():guardrail = _make_guardrail()diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.tsindex ddf2040cd04..80bc26a810d 100644--- a/ui/litellm-dashboard/src/lib/http/schema.d.ts+++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts@@ -706,60 +706,6 @@ export interface paths {patch?: never;trace?: never;};- "/audit": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- /**- * Get Audit Logs- * @description Get all audit logs with filtering and pagination.- *- * Returns a paginated response of audit logs matching the specified filters.- *- * Note: object_team_id and object_key_hash use Prisma JSON path filtering,- * which requires PostgreSQL.- */- get: operations["get_audit_logs_audit_get"];- put?: never;- post?: never;- delete?: never;- options?: never;- head?: never;- patch?: never;- trace?: never;- };- "/audit/{id}": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- /**- * Get Audit Log By Id- * @description Get detailed information about a specific audit log entry by its ID.- *- * Args:- * id (str): The unique identifier of the audit log entry- *- * Returns:- * AuditLogResponse: Detailed information about the audit log entry- *- * Raises:- * HTTPException: If the audit log is not found or if there's a database connection error- */- get: operations["get_audit_log_by_id_audit__id__get"];- put?: never;- post?: never;- delete?: never;- options?: never;- head?: never;- patch?: never;- trace?: never;- };"/azure/{endpoint}": {parameters: {query?: never;@@ -3170,50 +3116,6 @@ export interface paths {patch?: never;trace?: never;};- "/email/event_settings": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- /**- * Get Email Event Settings- * @description Get all email event settings- */- get: operations["get_email_event_settings_email_event_settings_get"];- put?: never;- post?: never;- delete?: never;- options?: never;- head?: never;- /**- * Update Event Settings- * @description Update the settings for email events- */- patch: operations["update_event_settings_email_event_settings_patch"];- trace?: never;- };- "/email/event_settings/reset": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- get?: never;- put?: never;- /**- * Reset Event Settings- * @description Reset all email event settings to default (new user invitations on, virtual key creation off)- */- post: operations["reset_event_settings_email_event_settings_reset_post"];- delete?: never;- options?: never;- head?: never;- patch?: never;- trace?: never;- };"/embeddings": {parameters: {query?: never;@@ -9964,240 +9866,6 @@ export interface paths {patch?: never;trace?: never;};- "/project/delete": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- get?: never;- put?: never;- post?: never;- /**- * Delete Project- * @description Delete projects- *- * Parameters:- * - project_ids: *List[str]* - List of project ids to delete- *- * Example:- * ```bash- * curl --location --request DELETE 'http://0.0.0.0:4000/project/delete' \- * --header 'Authorization: Bearer sk-1234' \- * --header 'Content-Type: application/json' \- * --data '{- * "project_ids": ["project-123", "project-456"]- * }'- * ```- */- delete: operations["delete_project_project_delete_delete"];- options?: never;- head?: never;- patch?: never;- trace?: never;- };- "/project/info": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- /**- * Project Info- * @description Get information about a specific project- *- * Parameters:- * - project_id: *str* - The project id to fetch info for- *- * Example:- * ```bash- * curl --location 'http://0.0.0.0:4000/project/info?project_id=project-123' \- * --header 'Authorization: Bearer sk-1234'- * ```- */- get: operations["project_info_project_info_get"];- put?: never;- post?: never;- delete?: never;- options?: never;- head?: never;- patch?: never;- trace?: never;- };- "/project/list": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- /**- * List Projects- * @description List all projects that the user has access to- *- * Example:- * ```bash- * curl --location 'http://0.0.0.0:4000/project/list' \- * --header 'Authorization: Bearer sk-1234'- * ```- */- get: operations["list_projects_project_list_get"];- put?: never;- post?: never;- delete?: never;- options?: never;- head?: never;- patch?: never;- trace?: never;- };- "/project/new": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- get?: never;- put?: never;- /**- * New Project- * @description Create a new project. Projects sit between teams and keys in the hierarchy.- *- * Only admins or team admins can create projects.- *- * # Parameters- *- * - project_alias: *Optional[str]* - The name of the project.- * - description: *Optional[str]* - Description of the project's purpose and use case.- * - team_id: *str* - The team id that this project belongs to. Required.- * - models: *List* - The models the project has access to.- * - budget_id: *Optional[str]* - The id for a budget (tpm/rpm/max budget) for the project.- * ### IF NO BUDGET ID - CREATE ONE WITH THESE PARAMS ###- * - max_budget: *Optional[float]* - Max budget for project- * - tpm_limit: *Optional[int]* - Max tpm limit for project- * - rpm_limit: *Optional[int]* - Max rpm limit for project- * - max_parallel_requests: *Optional[int]* - Max parallel requests for project- * - soft_budget: *Optional[float]* - Get a slack alert when this soft budget is reached. Don't block requests.- * - model_max_budget: *Optional[dict]* - Max budget for a specific model. Example: {"gpt-4": 100.0, "gpt-3.5-turbo": 50.0}- * - model_rpm_limit: *Optional[dict]* - RPM limits per model. Example: {"gpt-4": 1000, "gpt-3.5-turbo": 5000}- * - model_tpm_limit: *Optional[dict]* - TPM limits per model. Example: {"gpt-4": 50000, "gpt-3.5-turbo": 100000}- * - budget_duration: *Optional[str]* - Frequency of reseting project budget- * - metadata: *Optional[dict]* - Metadata for project, store information for project. Example metadata - {"use_case_id": "SNOW-12345", "responsible_ai_id": "RAI-67890"}- * - tags: *Optional[list]* - Tags for the project. Example: ["production", "api"]- * - blocked: *bool* - Flag indicating if the project is blocked or not - will stop all calls from keys with this project_id.- * - object_permission: Optional[LiteLLM_ObjectPermissionBase] - project-specific object permission. Example - {"vector_stores": ["vector_store_1", "vector_store_2"]}. IF null or {} then no object permission.- *- * Example 1: Create new project **without** a budget_id, with model-specific limits- *- * ```bash- * curl --location 'http://0.0.0.0:4000/project/new' \- * --header 'Authorization: Bearer sk-1234' \- * --header 'Content-Type: application/json' \- * --data '{- * "project_alias": "flight-search-assistant",- * "description": "AI-powered flight search and booking assistant",- * "team_id": "team-123",- * "models": ["gpt-4", "gpt-3.5-turbo"],- * "max_budget": 100,- * "model_rpm_limit": {- * "gpt-4": 1000,- * "gpt-3.5-turbo": 5000- * },- * "model_tpm_limit": {- * "gpt-4": 50000,- * "gpt-3.5-turbo": 100000- * },- * "metadata": {- * "use_case_id": "SNOW-12345",- * "responsible_ai_id": "RAI-67890"- * }- * }'- * ```- *- * Example 2: Create new project **with** a budget_id- *- * ```bash- * curl --location 'http://0.0.0.0:4000/project/new' \- * --header 'Authorization: Bearer sk-1234' \- * --header 'Content-Type: application/json' \- * --data '{- * "project_alias": "hotel-recommendations",- * "description": "Personalized hotel recommendation engine",- * "team_id": "team-123",- * "models": ["claude-3-sonnet"],- * "budget_id": "428eeaa8-f3ac-4e85-a8fb-7dc8d7aa8689",- * "metadata": {- * "use_case_id": "SNOW-54321"- * }- * }'- * ```- */- post: operations["new_project_project_new_post"];- delete?: never;- options?: never;- head?: never;- patch?: never;- trace?: never;- };- "/project/update": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- get?: never;- put?: never;- /**- * Update Project- * @description Update a project- *- * Parameters:- * - project_id: *str* - The project id to update. Required.- * - project_alias: *Optional[str]* - Updated name for the project- * - description: *Optional[str]* - Updated description for the project- * - team_id: *Optional[str]* - Updated team_id for the project- * - metadata: *Optional[dict]* - Updated metadata for project- * - models: *Optional[list]* - Updated list of models for the project- * - blocked: *Optional[bool]* - Updated blocked status- * - max_budget: *Optional[float]* - Updated max budget- * - tpm_limit: *Optional[int]* - Updated tpm limit- * - rpm_limit: *Optional[int]* - Updated rpm limit- * - model_rpm_limit: *Optional[dict]* - Updated RPM limits per model- * - model_tpm_limit: *Optional[dict]* - Updated TPM limits per model- * - budget_duration: *Optional[str]* - Updated budget duration- * - tags: *Optional[list]* - Updated list of tags for the project- * - object_permission: Optional[LiteLLM_ObjectPermissionBase] - Updated object permission- *- * Example:- * ```bash- * curl --location 'http://0.0.0.0:4000/project/update' \- * --header 'Authorization: Bearer sk-1234' \- * --header 'Content-Type: application/json' \- * --data '{- * "project_id": "project-123",- * "description": "Updated flight search system with enhanced capabilities",- * "max_budget": 200,- * "model_rpm_limit": {- * "gpt-4": 2000,- * "gpt-3.5-turbo": 10000- * },- * "metadata": {- * "use_case_id": "SNOW-12345",- * "status": "active"- * }- * }'- * ```- */- post: operations["update_project_project_update_post"];- delete?: never;- options?: never;- head?: never;- patch?: never;- trace?: never;- };"/prompts": {parameters: {query?: never;@@ -11240,27 +10908,6 @@ export interface paths {patch?: never;trace?: never;};- "/robots.txt": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- /**- * Get Robots- * @description Block all web crawlers from indexing the proxy server endpoints- * This is useful for ensuring that the API endpoints aren't indexed by search engines- */- get: operations["get_robots_robots_txt_get"];- put?: never;- post?: never;- delete?: never;- options?: never;- head?: never;- patch?: never;- trace?: never;- };"/router/fields": {parameters: {query?: never;@@ -14300,26 +13947,6 @@ export interface paths {patch?: never;trace?: never;};- "/user/available_users": {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- /**- * Available Enterprise Users- * @description For keys with `max_users` set, return the list of users that are allowed to use the key.- */- get: operations["available_enterprise_users_user_available_users_get"];- put?: never;- post?: never;- delete?: never;- options?: never;- head?: never;- patch?: never;- trace?: never;- };"/user/bulk_update": {parameters: {query?: never;@@ -20600,37 +20227,6 @@ export interface components {*/unnamed_teams_count: number;};- /**- * AuditLogResponse- * @description Response model for a single audit log entry- */- AuditLogResponse: {- /** Action */- action: string;- /** Before Value */- before_value?: {- [key: string]: unknown;- } | null;- /** Changed By */- changed_by: string;- /** Changed By Api Key */- changed_by_api_key: string;- /** Id */- id: string;- /** Object Id */- object_id: string;- /** Table Name */- table_name: string;- /**- * Updated At- * Format: date-time- */- updated_at: string;- /** Updated Values */- updated_values?: {- [key: string]: unknown;- } | null;- };/** BaseLitellmParams */"BaseLitellmParams-Input": {/**@@ -23120,14 +22716,6 @@ export interface components {/** Organization Ids */organization_ids: string[];};- /**- * DeleteProjectRequest- * @description Request model for DELETE /project/delete- */- DeleteProjectRequest: {- /** Project Ids */- project_ids: string[];- };/*** DeleteSkillResponse* @description Response from deleting a skill@@ -23242,27 +22830,6 @@ export interface components {/** Write Capacity Units */write_capacity_units?: number | null;};- /**- * EmailEvent- * @enum {string}- */- EmailEvent: "Virtual Key Created" | "New User Invitation" | "Virtual Key Rotated" | "Soft Budget Crossed" | "Max Budget Alert";- /** EmailEventSettings */- EmailEventSettings: {- /** Enabled */- enabled: boolean;- event: components["schemas"]["EmailEvent"];- };- /** EmailEventSettingsResponse */- EmailEventSettingsResponse: {- /** Settings */- settings: components["schemas"]["EmailEventSettings"][];- };- /** EmailEventSettingsUpdateRequest */- EmailEventSettingsUpdateRequest: {- /** Settings */- settings: components["schemas"]["EmailEventSettings"][];- };/** EmbeddingRequest */EmbeddingRequest: {/**@@ -25556,65 +25123,6 @@ export interface components {} & {[key: string]: unknown;};- /**- * LiteLLM_ProjectTable- * @description Database model representation for project- */- LiteLLM_ProjectTable: {- /**- * Blocked- * @default false- */- blocked: boolean;- /** Budget Id */- budget_id?: string | null;- /** Created At */- created_at?: string | null;- /** Created By */- created_by?: string | null;- /** Description */- description?: string | null;- litellm_budget_table?: components["schemas"]["LiteLLM_BudgetTable"] | null;- /** Metadata */- metadata?: {- [key: string]: unknown;- } | null;- /** Model Rpm Limit */- model_rpm_limit?: {- [key: string]: unknown;- } | null;- /** Model Spend */- model_spend?: {- [key: string]: unknown;- } | null;- /** Model Tpm Limit */- model_tpm_limit?: {- [key: string]: unknown;- } | null;- /**- * Models- * @default []- */- models: string[];- object_permission?: components["schemas"]["LiteLLM_ObjectPermissionTable"] | null;- /** Object Permission Id */- object_permission_id?: string | null;- /** Project Alias */- project_alias?: string | null;- /** Project Id */- project_id: string;- /**- * Spend- * @default 0- */- spend: number;- /** Team Id */- team_id?: string | null;- /** Updated At */- updated_at?: string | null;- /** Updated By */- updated_by?: string | null;- };/** LiteLLM_ProxyModelTable */LiteLLM_ProxyModelTable: {/**@@ -27625,134 +27133,6 @@ export interface components {/** Users */users?: components["schemas"]["LiteLLM_UserTable"][] | null;};- /**- * NewProjectRequest- * @description Request model for POST /project/new- */- NewProjectRequest: {- /** Allowed Models */- allowed_models?: string[] | null;- /**- * Blocked- * @default false- */- blocked: boolean;- /** Budget Duration */- budget_duration?: string | null;- /** Budget Id */- budget_id?: string | null;- /** Description */- description?: string | null;- /** Guardrails */- guardrails?: string[] | null;- /** Max Budget */- max_budget?: number | null;- /** Max Parallel Requests */- max_parallel_requests?: number | null;- /** Metadata */- metadata?: {- [key: string]: unknown;- } | null;- /** Model Max Budget */- model_max_budget?: {- [key: string]: unknown;- } | null;- /** Model Rpm Limit */- model_rpm_limit?: {- [key: string]: unknown;- } | null;- /** Model Tpm Limit */- model_tpm_limit?: {- [key: string]: unknown;- } | null;- /**- * Models- * @default []- */- models: string[];- object_permission?: components["schemas"]["LiteLLM_ObjectPermissionBase"] | null;- /** Policies */- policies?: string[] | null;- /** Project Alias */- project_alias?: string | null;- /** Project Id */- project_id?: string | null;- /** Rpm Limit */- rpm_limit?: number | null;- /** Soft Budget */- soft_budget?: number | null;- /** Tags */- tags?: string[] | null;- /** Team Id */- team_id: string;- /** Tpm Limit */- tpm_limit?: number | null;- };- /**- * NewProjectResponse- * @description Response model for POST /project/new- */- NewProjectResponse: {- /**- * Blocked- * @default false- */- blocked: boolean;- /** Budget Id */- budget_id?: string | null;- /**- * Created At- * Format: date-time- */- created_at: string;- /** Created By */- created_by?: string | null;- /** Description */- description?: string | null;- litellm_budget_table?: components["schemas"]["LiteLLM_BudgetTable"] | null;- /** Metadata */- metadata?: {- [key: string]: unknown;- } | null;- /** Model Rpm Limit */- model_rpm_limit?: {- [key: string]: unknown;- } | null;- /** Model Spend */- model_spend?: {- [key: string]: unknown;- } | null;- /** Model Tpm Limit */- model_tpm_limit?: {- [key: string]: unknown;- } | null;- /**- * Models- * @default []- */- models: string[];- object_permission?: components["schemas"]["LiteLLM_ObjectPermissionTable"] | null;- /** Object Permission Id */- object_permission_id?: string | null;- /** Project Alias */- project_alias?: string | null;- /** Project Id */- project_id: string;- /**- * Spend- * @default 0- */- spend: number;- /** Team Id */- team_id?: string | null;- /**- * Updated At- * Format: date-time- */- updated_at: string;- /** Updated By */- updated_by?: string | null;- };/** NewTeamRequest */NewTeamRequest: {/** Access Group Ids */@@ -28262,34 +27642,6 @@ export interface components {/** Organizations */organizations: string[];};- /**- * PaginatedAuditLogResponse- * @description Response model for paginated audit logs- */- PaginatedAuditLogResponse: {- /** Audit Logs */- audit_logs: components["schemas"]["AuditLogResponse"][];- /**- * Page- * @description Current page number- */- page: number;- /**- * Page Size- * @description Number of items per page- */- page_size: number;- /**- * Total- * @description Total number of audit logs matching the filters- */- total: number;- /**- * Total Pages- * @description Total number of pages- */- total_pages: number;- };/** PassThroughEndpointResponse */PassThroughEndpointResponse: {/** Endpoints */@@ -31800,63 +31152,6 @@ export interface components {/** Model Names */model_names?: string[] | null;};- /**- * UpdateProjectRequest- * @description Request model for POST /project/update- */- UpdateProjectRequest: {- /** Allowed Models */- allowed_models?: string[] | null;- /** Blocked */- blocked?: boolean | null;- /** Budget Duration */- budget_duration?: string | null;- /** Budget Id */- budget_id?: string | null;- /** Description */- description?: string | null;- /** Guardrails */- guardrails?: string[] | null;- /** Max Budget */- max_budget?: number | null;- /** Max Parallel Requests */- max_parallel_requests?: number | null;- /** Metadata */- metadata?: {- [key: string]: unknown;- } | null;- /** Model Max Budget */- model_max_budget?: {- [key: string]: unknown;- } | null;- /** Model Rpm Limit */- model_rpm_limit?: {- [key: string]: unknown;- } | null;- /** Model Tpm Limit */- model_tpm_limit?: {- [key: string]: unknown;- } | null;- /** Models */- models?: string[] | null;- object_permission?: components["schemas"]["LiteLLM_ObjectPermissionBase"] | null;- /** Policies */- policies?: string[] | null;- /** Project Alias */- project_alias?: string | null;- /** Project Id */- project_id: string;- /** Rpm Limit */- rpm_limit?: number | null;- /** Soft Budget */- soft_budget?: number | null;- /** Tags */- tags?: string[] | null;- /** Team Id */- team_id?: string | null;- /** Tpm Limit */- tpm_limit?: number | null;- };/*** UpdatePublicModelGroupsRequest* @description Request model for updating public model groups@@ -34300,105 +33595,6 @@ export interface operations {};};};- get_audit_logs_audit_get: {- parameters: {- query?: {- page?: number;- page_size?: number;- /** @description Filter by user or system that performed the action */- changed_by?: string | null;- /** @description Filter by API key hash that performed the action */- changed_by_api_key?: string | null;- /** @description Filter by action type (create, update, delete) */- action?: string | null;- /** @description Filter by table name that was modified */- table_name?: string | null;- /** @description Filter by ID of the object that was modified */- object_id?: string | null;- /** @description Filter logs after this date */- start_date?: string | null;- /** @description Filter logs before this date */- end_date?: string | null;- /** @description Filter by team_id present in before_value or updated_values JSON (PostgreSQL only) */- object_team_id?: string | null;- /** @description Filter by token (key hash) present in before_value or updated_values JSON (PostgreSQL only) */- object_key_hash?: string | null;- /** @description Column to sort by (e.g. 'updated_at', 'action', 'table_name') */- sort_by?: string | null;- /** @description Sort order ('asc' or 'desc') */- sort_order?: string;- };- header?: never;- path?: never;- cookie?: never;- };- requestBody?: never;- responses: {- /** @description Successful Response */- 200: {- headers: {- [name: string]: unknown;- };- content: {- "application/json": components["schemas"]["PaginatedAuditLogResponse"];- };- };- /** @description Validation Error */- 422: {- headers: {- [name: string]: unknown;- };- content: {- "application/json": components["schemas"]["HTTPValidationError"];- };- };- };- };- get_audit_log_by_id_audit__id__get: {- parameters: {- query?: never;- header?: never;- path: {- id: string;- };- cookie?: never;- };- requestBody?: never;- responses: {- /** @description Successful Response */- 200: {- headers: {- [name: string]: unknown;- };- content: {- "application/json": components["schemas"]["AuditLogResponse"];- };- };- /** @description Audit log not found */- 404: {- headers: {- [name: string]: unknown;- };- content?: never;- };- /** @description Validation Error */- 422: {- headers: {- [name: string]: unknown;- };- content: {- "application/json": components["schemas"]["HTTPValidationError"];- };- };- /** @description Database connection error */- 500: {- headers: {- [name: string]: unknown;- };- content?: never;- };- };- };azure_proxy_route_azure__endpoint__get: {parameters: {query?: never;@@ -37924,79 +37120,6 @@ export interface operations {};};};- get_email_event_settings_email_event_settings_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"]["EmailEventSettingsResponse"];- };- };- };- };- update_event_settings_email_event_settings_patch: {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- requestBody: {- content: {- "application/json": components["schemas"]["EmailEventSettingsUpdateRequest"];- };- };- 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"];- };- };- };- };- reset_event_settings_email_event_settings_reset_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;- };- };- };- };embeddings_embeddings_post: {parameters: {query?: never;@@ -45554,151 +44677,13 @@ export interface operations {};};};- list_policy_versions_policies_name__policy_name__versions_get: {- parameters: {- query?: never;- header?: never;- path: {- policy_name: string;- };- cookie?: never;- };- requestBody?: never;- responses: {- /** @description Successful Response */- 200: {- headers: {- [name: string]: unknown;- };- content: {- "application/json": components["schemas"]["PolicyVersionListResponse"];- };- };- /** @description Validation Error */- 422: {- headers: {- [name: string]: unknown;- };- content: {- "application/json": components["schemas"]["HTTPValidationError"];- };- };- };- };- create_policy_version_policies_name__policy_name__versions_post: {- parameters: {- query?: never;- header?: never;- path: {- policy_name: string;- };- cookie?: never;- };- requestBody: {- content: {- "application/json": components["schemas"]["PolicyVersionCreateRequest"];- };- };- responses: {- /** @description Successful Response */- 200: {- headers: {- [name: string]: unknown;- };- content: {- "application/json": components["schemas"]["PolicyDBResponse"];- };- };- /** @description Validation Error */- 422: {- headers: {- [name: string]: unknown;- };- content: {- "application/json": components["schemas"]["HTTPValidationError"];- };- };- };- };- resolve_policies_for_context_policies_resolve_post: {- parameters: {- query?: {- /** @description Force a DB sync before resolving. Default uses in-memory cache. */- force_sync?: boolean;- };- header?: never;- path?: never;- cookie?: never;- };- requestBody: {- content: {- "application/json": components["schemas"]["PolicyResolveRequest"];- };- };- responses: {- /** @description Successful Response */- 200: {- headers: {- [name: string]: unknown;- };- content: {- "application/json": components["schemas"]["PolicyResolveResponse"];- };- };- /** @description Validation Error */- 422: {- headers: {- [name: string]: unknown;- };- content: {- "application/json": components["schemas"]["HTTPValidationError"];- };- };- };- };- test_pipeline_policies_test_pipeline_post: {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- requestBody: {- content: {- "application/json": components["schemas"]["PipelineTestRequest"];- };- };- 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"];- };- };- };- };- policies_usage_overview_policies_usage_overview_get: {+ list_policy_versions_policies_name__policy_name__versions_get: {parameters: {- query?: {- /** @description YYYY-MM-DD */- start_date?: string | null;- /** @description YYYY-MM-DD */- end_date?: string | null;- };+ query?: never;header?: never;- path?: never;+ path: {+ policy_name: string;+ };cookie?: never;};requestBody?: never;@@ -45709,7 +44694,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["UsageOverviewResponse"];+ "application/json": components["schemas"]["PolicyVersionListResponse"];};};/** @description Validation Error */@@ -45723,16 +44708,20 @@ export interface operations {};};};- get_policy_policies__policy_id__get: {+ create_policy_version_policies_name__policy_name__versions_post: {parameters: {query?: never;header?: never;path: {- policy_id: string;+ policy_name: string;};cookie?: never;};- requestBody?: never;+ requestBody: {+ content: {+ "application/json": components["schemas"]["PolicyVersionCreateRequest"];+ };+ };responses: {/** @description Successful Response */200: {@@ -45754,18 +44743,19 @@ export interface operations {};};};- update_policy_policies__policy_id__put: {+ resolve_policies_for_context_policies_resolve_post: {parameters: {- query?: never;- header?: never;- path: {- policy_id: string;+ query?: {+ /** @description Force a DB sync before resolving. Default uses in-memory cache. */+ force_sync?: boolean;};+ header?: never;+ path?: never;cookie?: never;};requestBody: {content: {- "application/json": components["schemas"]["PolicyUpdateRequest"];+ "application/json": components["schemas"]["PolicyResolveRequest"];};};responses: {@@ -45775,7 +44765,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["PolicyDBResponse"];+ "application/json": components["schemas"]["PolicyResolveResponse"];};};/** @description Validation Error */@@ -45789,16 +44779,18 @@ export interface operations {};};};- delete_policy_policies__policy_id__delete: {+ test_pipeline_policies_test_pipeline_post: {parameters: {query?: never;header?: never;- path: {- policy_id: string;- };+ path?: never;cookie?: never;};- requestBody?: never;+ requestBody: {+ content: {+ "application/json": components["schemas"]["PipelineTestRequest"];+ };+ };responses: {/** @description Successful Response */200: {@@ -45820,13 +44812,16 @@ export interface operations {};};};- get_resolved_guardrails_policies__policy_id__resolved_guardrails_get: {+ policies_usage_overview_policies_usage_overview_get: {parameters: {- query?: never;- header?: never;- path: {- policy_id: string;+ query?: {+ /** @description YYYY-MM-DD */+ start_date?: string | null;+ /** @description YYYY-MM-DD */+ end_date?: string | null;};+ header?: never;+ path?: never;cookie?: never;};requestBody?: never;@@ -45837,7 +44832,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": unknown;+ "application/json": components["schemas"]["UsageOverviewResponse"];};};/** @description Validation Error */@@ -45851,7 +44846,7 @@ export interface operations {};};};- update_policy_version_status_policies__policy_id__status_put: {+ get_policy_policies__policy_id__get: {parameters: {query?: never;header?: never;@@ -45860,11 +44855,7 @@ export interface operations {};cookie?: never;};- requestBody: {- content: {- "application/json": components["schemas"]["PolicyVersionStatusUpdateRequest"];- };- };+ requestBody?: never;responses: {/** @description Successful Response */200: {@@ -45886,16 +44877,20 @@ export interface operations {};};};- get_policy_info_policy_info__policy_name__get: {+ update_policy_policies__policy_id__put: {parameters: {query?: never;header?: never;path: {- policy_name: string;+ policy_id: string;};cookie?: never;};- requestBody?: never;+ requestBody: {+ content: {+ "application/json": components["schemas"]["PolicyUpdateRequest"];+ };+ };responses: {/** @description Successful Response */200: {@@ -45903,7 +44898,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["PolicyInfoResponse"];+ "application/json": components["schemas"]["PolicyDBResponse"];};};/** @description Validation Error */@@ -45917,11 +44912,13 @@ export interface operations {};};};- list_policies_policy_list_get: {+ delete_policy_policies__policy_id__delete: {parameters: {query?: never;header?: never;- path?: never;+ path: {+ policy_id: string;+ };cookie?: never;};requestBody?: never;@@ -45932,43 +44929,30 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["PolicyListResponse"];+ "application/json": unknown;};};- };- };- get_policy_templates_policy_templates_get: {- parameters: {- query?: never;- header?: never;- path?: never;- cookie?: never;- };- requestBody?: never;- responses: {- /** @description Successful Response */- 200: {+ /** @description Validation Error */+ 422: {headers: {[name: string]: unknown;};content: {- "application/json": unknown[];+ "application/json": components["schemas"]["HTTPValidationError"];};};};};- enrich_policy_template_policy_templates_enrich_post: {+ get_resolved_guardrails_policies__policy_id__resolved_guardrails_get: {parameters: {query?: never;header?: never;- path?: never;- cookie?: never;- };- requestBody: {- content: {- "application/json": components["schemas"]["EnrichTemplateRequest"];+ path: {+ policy_id: string;};+ cookie?: never;};+ requestBody?: never;responses: {/** @description Successful Response */200: {@@ -45976,9 +44960,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": {- [key: string]: unknown;- };+ "application/json": unknown;};};/** @description Validation Error */@@ -45992,16 +44974,18 @@ export interface operations {};};};- enrich_policy_template_stream_policy_templates_enrich_stream_post: {+ update_policy_version_status_policies__policy_id__status_put: {parameters: {query?: never;header?: never;- path?: never;+ path: {+ policy_id: string;+ };cookie?: never;};requestBody: {content: {- "application/json": components["schemas"]["EnrichTemplateRequest"];+ "application/json": components["schemas"]["PolicyVersionStatusUpdateRequest"];};};responses: {@@ -46011,7 +44995,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": unknown;+ "application/json": components["schemas"]["PolicyDBResponse"];};};/** @description Validation Error */@@ -46025,18 +45009,16 @@ export interface operations {};};};- suggest_policy_templates_policy_templates_suggest_post: {+ get_policy_info_policy_info__policy_name__get: {parameters: {query?: never;header?: never;- path?: never;- cookie?: never;- };- requestBody: {- content: {- "application/json": components["schemas"]["SuggestTemplatesRequest"];+ path: {+ policy_name: string;};+ cookie?: never;};+ requestBody?: never;responses: {/** @description Successful Response */200: {@@ -46044,9 +45026,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": {- [key: string]: unknown;- };+ "application/json": components["schemas"]["PolicyInfoResponse"];};};/** @description Validation Error */@@ -46060,18 +45040,14 @@ export interface operations {};};};- test_policy_template_policy_templates_test_post: {+ list_policies_policy_list_get: {parameters: {query?: never;header?: never;path?: never;cookie?: never;};- requestBody: {- content: {- "application/json": components["schemas"]["TestPolicyTemplateRequest"];- };- };+ requestBody?: never;responses: {/** @description Successful Response */200: {@@ -46079,21 +45055,32 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["TestPolicyTemplateResponse"];+ "application/json": components["schemas"]["PolicyListResponse"];};};- /** @description Validation Error */- 422: {+ };+ };+ get_policy_templates_policy_templates_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"]["HTTPValidationError"];+ "application/json": unknown[];};};};};- test_policy_matching_policy_test_post: {+ enrich_policy_template_policy_templates_enrich_post: {parameters: {query?: never;header?: never;@@ -46102,7 +45089,7 @@ export interface operations {};requestBody: {content: {- "application/json": components["schemas"]["PolicyMatchContext"];+ "application/json": components["schemas"]["EnrichTemplateRequest"];};};responses: {@@ -46112,7 +45099,9 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["PolicyTestResponse"];+ "application/json": {+ [key: string]: unknown;+ };};};/** @description Validation Error */@@ -46126,7 +45115,7 @@ export interface operations {};};};- validate_policy_policy_validate_post: {+ enrich_policy_template_stream_policy_templates_enrich_stream_post: {parameters: {query?: never;header?: never;@@ -46135,7 +45124,7 @@ export interface operations {};requestBody: {content: {- "application/json": components["schemas"]["PolicyValidateRequest"];+ "application/json": components["schemas"]["EnrichTemplateRequest"];};};responses: {@@ -46145,7 +45134,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["PolicyValidationResponse"];+ "application/json": unknown;};};/** @description Validation Error */@@ -46159,7 +45148,7 @@ export interface operations {};};};- delete_project_project_delete_delete: {+ suggest_policy_templates_policy_templates_suggest_post: {parameters: {query?: never;header?: never;@@ -46168,7 +45157,7 @@ export interface operations {};requestBody: {content: {- "application/json": components["schemas"]["DeleteProjectRequest"];+ "application/json": components["schemas"]["SuggestTemplatesRequest"];};};responses: {@@ -46178,7 +45167,9 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["LiteLLM_ProjectTable"][];+ "application/json": {+ [key: string]: unknown;+ };};};/** @description Validation Error */@@ -46192,16 +45183,18 @@ export interface operations {};};};- project_info_project_info_get: {+ test_policy_template_policy_templates_test_post: {parameters: {- query: {- project_id: string;- };+ query?: never;header?: never;path?: never;cookie?: never;};- requestBody?: never;+ requestBody: {+ content: {+ "application/json": components["schemas"]["TestPolicyTemplateRequest"];+ };+ };responses: {/** @description Successful Response */200: {@@ -46209,7 +45202,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["LiteLLM_ProjectTable"];+ "application/json": components["schemas"]["TestPolicyTemplateResponse"];};};/** @description Validation Error */@@ -46223,27 +45216,7 @@ export interface operations {};};};- list_projects_project_list_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"]["LiteLLM_ProjectTable"][];- };- };- };- };- new_project_project_new_post: {+ test_policy_matching_policy_test_post: {parameters: {query?: never;header?: never;@@ -46252,7 +45225,7 @@ export interface operations {};requestBody: {content: {- "application/json": components["schemas"]["NewProjectRequest"];+ "application/json": components["schemas"]["PolicyMatchContext"];};};responses: {@@ -46262,7 +45235,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["NewProjectResponse"];+ "application/json": components["schemas"]["PolicyTestResponse"];};};/** @description Validation Error */@@ -46276,7 +45249,7 @@ export interface operations {};};};- update_project_project_update_post: {+ validate_policy_policy_validate_post: {parameters: {query?: never;header?: never;@@ -46285,7 +45258,7 @@ export interface operations {};requestBody: {content: {- "application/json": components["schemas"]["UpdateProjectRequest"];+ "application/json": components["schemas"]["PolicyValidateRequest"];};};responses: {@@ -46295,7 +45268,7 @@ export interface operations {[name: string]: unknown;};content: {- "application/json": components["schemas"]["LiteLLM_ProjectTable"];+ "application/json": components["schemas"]["PolicyValidationResponse"];};};/** @description Validation Error */@@ -47221,26 +46194,6 @@ export interface operations {};};};- get_robots_robots_txt_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_router_fields_router_fields_get: {parameters: {query?: never;@@ -50847,26 +49800,6 @@ export interface operations {};};};- available_enterprise_users_user_available_users_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;- };- };- };- };bulk_user_update_user_bulk_update_post: {parameters: {query?: never;