- Add mask_api_key() and is_masked_or_placeholder() to llm_provider service - Return masked keys in all provider CRUD endpoints - Reject masked/placeholder keys in fetch_models and test_provider_config - Show masked key with Change button in ProviderConfig.svelte edit form - Exclude masked keys from fetch-models, test, and submit payloads on frontend - Update semantics-core skill with clarified complexity tier rules - Switch agent modes from subagent to all
1150 lines
39 KiB
JSON
1150 lines
39 KiB
JSON
{
|
|
"/guardrails": {
|
|
"post": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Create Guardrail",
|
|
"description": "Create a new guardrail\n\n\ud83d\udc49 [Guardrail docs](https://docs.litellm.ai/docs/proxy/guardrails/quick_start)\n\nExample Request:\n```bash\ncurl -X POST \"http://localhost:4000/guardrails\" \\\n -H \"Authorization: Bearer <your_api_key>\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"guardrail\": {\n \"guardrail_name\": \"my-bedrock-guard\",\n \"litellm_params\": {\n \"guardrail\": \"bedrock\",\n \"mode\": \"pre_call\",\n \"guardrailIdentifier\": \"ff6ujrregl1q\",\n \"guardrailVersion\": \"DRAFT\",\n \"default_on\": true\n },\n \"guardrail_info\": {\n \"description\": \"Bedrock content moderation guardrail\"\n }\n }\n }'\n```\n\nExample Response:\n```json\n{\n \"guardrail_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"guardrail_name\": \"my-bedrock-guard\",\n \"litellm_params\": {\n \"guardrail\": \"bedrock\",\n \"mode\": \"pre_call\",\n \"guardrailIdentifier\": \"ff6ujrregl1q\",\n \"guardrailVersion\": \"DRAFT\",\n \"default_on\": true\n },\n \"guardrail_info\": {\n \"description\": \"Bedrock content moderation guardrail\"\n },\n \"created_at\": \"2023-11-09T12:34:56.789Z\",\n \"updated_at\": \"2023-11-09T12:34:56.789Z\"\n}\n```",
|
|
"operationId": "create_guardrail_guardrails_post",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/CreateGuardrailRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/guardrails/apply_guardrail": {
|
|
"post": {
|
|
"summary": "Apply Guardrail",
|
|
"description": "Apply a guardrail to text input and return the processed result.\n\nThis endpoint allows testing guardrails by applying them to custom text inputs.",
|
|
"operationId": "apply_guardrail_guardrails_apply_guardrail_post",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ApplyGuardrailRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ApplyGuardrailResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/guardrails/list": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "List Guardrails",
|
|
"description": "List the guardrails that are available on the proxy server\n\n\ud83d\udc49 [Guardrail docs](https://docs.litellm.ai/docs/proxy/guardrails/quick_start)\n\nExample Request:\n```bash\ncurl -X GET \"http://localhost:4000/guardrails/list\" -H \"Authorization: Bearer <your_api_key>\"\n```\n\nExample Response:\n```json\n{\n \"guardrails\": [\n {\n \"guardrail_name\": \"bedrock-pre-guard\",\n \"guardrail_info\": {\n \"params\": [\n {\n \"name\": \"toxicity_score\",\n \"type\": \"float\",\n \"description\": \"Score between 0-1 indicating content toxicity level\"\n },\n {\n \"name\": \"pii_detection\",\n \"type\": \"boolean\"\n }\n ]\n }\n }\n ]\n}\n```",
|
|
"operationId": "list_guardrails_guardrails_list_get",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ListGuardrailsResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/guardrails/register": {
|
|
"post": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Register Guardrail",
|
|
"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",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/RegisterGuardrailRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/RegisterGuardrailResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/guardrails/submissions": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "List Guardrail Submissions",
|
|
"description": "List team guardrail submissions. Returns only guardrails with a team_id.\n\nAdmins see all submissions. Non-admin users see submissions for teams they are\na member of.\n\nStatus values: pending_review (team-registered, awaiting approval), active (approved), rejected.\n\nOptional filters:\n- status: pending_review | active | rejected\n- team_id: filter by specific team (non-admins must be a member of that team)\n- search: name/description",
|
|
"operationId": "list_guardrail_submissions_guardrails_submissions_get",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "status",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Status"
|
|
}
|
|
},
|
|
{
|
|
"name": "team_id",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Team Id"
|
|
}
|
|
},
|
|
{
|
|
"name": "search",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Search"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ListGuardrailSubmissionsResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/guardrails/submissions/{guardrail_id}": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Get Guardrail Submission",
|
|
"description": "Get a single guardrail submission by id. Non-admins may only access submissions for teams they belong to.",
|
|
"operationId": "get_guardrail_submission_guardrails_submissions__guardrail_id__get",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "guardrail_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Guardrail Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/GuardrailSubmissionItem"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/guardrails/submissions/{guardrail_id}/approve": {
|
|
"post": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Approve Guardrail Submission",
|
|
"description": "Approve a pending guardrail submission: set status to active and initialize in memory (admin only).",
|
|
"operationId": "approve_guardrail_submission_guardrails_submissions__guardrail_id__approve_post",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "guardrail_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Guardrail Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/guardrails/submissions/{guardrail_id}/reject": {
|
|
"post": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Reject Guardrail Submission",
|
|
"description": "Reject a guardrail submission (admin only).",
|
|
"operationId": "reject_guardrail_submission_guardrails_submissions__guardrail_id__reject_post",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "guardrail_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Guardrail Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/guardrails/test_custom_code": {
|
|
"post": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Test Custom Code Guardrail",
|
|
"description": "Test custom code guardrail logic without creating a guardrail.\n\nThis endpoint allows admins to experiment with custom code guardrails by:\n1. Compiling the provided code in a sandbox\n2. Executing the apply_guardrail function with test input\n3. Returning the result (allow/block/modify)\n\n\ud83d\udc49 [Custom Code Guardrail docs](https://docs.litellm.ai/docs/proxy/guardrails/custom_code_guardrail)\n\nExample Request:\n```bash\ncurl -X POST \"http://localhost:4000/guardrails/test_custom_code\" \\\n -H \"Authorization: Bearer <your_api_key>\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"custom_code\": \"def apply_guardrail(inputs, request_data, input_type):\\n for text in inputs[\\\"texts\\\"]:\\n if regex_match(text, r\\\"\\\\d{3}-\\\\d{2}-\\\\d{4}\\\"):\\n return block(\\\"SSN detected\\\")\\n return allow()\",\n \"test_input\": {\n \"texts\": [\"My SSN is 123-45-6789\"]\n },\n \"input_type\": \"request\"\n }'\n```\n\nExample Success Response (blocked):\n```json\n{\n \"success\": true,\n \"result\": {\n \"action\": \"block\",\n \"reason\": \"SSN detected\"\n },\n \"error\": null,\n \"error_type\": null\n}\n```\n\nExample Success Response (allowed):\n```json\n{\n \"success\": true,\n \"result\": {\n \"action\": \"allow\"\n },\n \"error\": null,\n \"error_type\": null\n}\n```\n\nExample Success Response (modified):\n```json\n{\n \"success\": true,\n \"result\": {\n \"action\": \"modify\",\n \"texts\": [\"My SSN is [REDACTED]\"]\n },\n \"error\": null,\n \"error_type\": null\n}\n```\n\nExample Error Response (compilation error):\n```json\n{\n \"success\": false,\n \"result\": null,\n \"error\": \"Syntax error in custom code: invalid syntax (<guardrail>, line 1)\",\n \"error_type\": \"compilation\"\n}\n```",
|
|
"operationId": "test_custom_code_guardrail_guardrails_test_custom_code_post",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/TestCustomCodeGuardrailRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/TestCustomCodeGuardrailResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/guardrails/ui/add_guardrail_settings": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Get Guardrail Ui Settings",
|
|
"description": "Get the UI settings for the guardrails\n\nReturns:\n- Supported entities for guardrails\n- Supported modes for guardrails\n- PII entity categories for UI organization\n- Content filter settings (patterns and categories)",
|
|
"operationId": "get_guardrail_ui_settings_guardrails_ui_add_guardrail_settings_get",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/guardrails/ui/category_yaml/{category_name}": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Get Category Yaml",
|
|
"description": "Get the YAML or JSON content for a specific content filter category.\n\nArgs:\n category_name: The name of the category (e.g., \"bias_gender\", \"harmful_self_harm\")\n\nReturns:\n The raw YAML or JSON content of the category file with file type indicator",
|
|
"operationId": "get_category_yaml_guardrails_ui_category_yaml__category_name__get",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "category_name",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Category Name"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/guardrails/ui/major_airlines": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Get Major Airlines",
|
|
"description": "Get the major airlines list from IATA (competitor intent, airline type).\nReturns airline id, match variants (pipe-separated), and tags.",
|
|
"operationId": "get_major_airlines_guardrails_ui_major_airlines_get",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/guardrails/ui/provider_specific_params": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Get Provider Specific Params",
|
|
"description": "Get provider-specific parameters for different guardrail types.\n\nReturns a dictionary mapping guardrail providers to their specific parameters,\nincluding parameter names, descriptions, and whether they are required.\n\nExample Response:\n```json\n{\n \"bedrock\": {\n \"guardrailIdentifier\": {\n \"description\": \"The ID of your guardrail on Bedrock\",\n \"required\": true,\n \"type\": null\n },\n \"guardrailVersion\": {\n \"description\": \"The version of your Bedrock guardrail (e.g., DRAFT or version number)\",\n \"required\": true,\n \"type\": null\n }\n },\n \"azure_content_safety_text_moderation\": {\n \"api_key\": {\n \"description\": \"API key for the Azure Content Safety Text Moderation guardrail\",\n \"required\": false,\n \"type\": null\n },\n \"optional_params\": {\n \"description\": \"Optional parameters for the Azure Content Safety Text Moderation guardrail\",\n \"required\": true,\n \"type\": \"nested\",\n \"fields\": {\n \"severity_threshold\": {\n \"description\": \"Severity threshold for the Azure Content Safety Text Moderation guardrail across all categories\",\n \"required\": false,\n \"type\": null\n },\n \"categories\": {\n \"description\": \"Categories to scan for the Azure Content Safety Text Moderation guardrail\",\n \"required\": false,\n \"type\": \"multiselect\",\n \"options\": [\"Hate\", \"SelfHarm\", \"Sexual\", \"Violence\"],\n \"default_value\": None\n }\n }\n }\n }\n}\n```",
|
|
"operationId": "get_provider_specific_params_guardrails_ui_provider_specific_params_get",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/guardrails/usage/detail/{guardrail_id}": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Guardrails Usage Detail",
|
|
"description": "Return single guardrail usage metrics and time series.",
|
|
"operationId": "guardrails_usage_detail_guardrails_usage_detail__guardrail_id__get",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "guardrail_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Guardrail Id"
|
|
}
|
|
},
|
|
{
|
|
"name": "start_date",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Start Date"
|
|
}
|
|
},
|
|
{
|
|
"name": "end_date",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "End Date"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/UsageDetailResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/guardrails/usage/logs": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Guardrails Usage Logs",
|
|
"description": "Return paginated run logs for a guardrail (or policy) from SpendLogs via index.",
|
|
"operationId": "guardrails_usage_logs_guardrails_usage_logs_get",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "guardrail_id",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Guardrail Id"
|
|
}
|
|
},
|
|
{
|
|
"name": "policy_id",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Policy Id"
|
|
}
|
|
},
|
|
{
|
|
"name": "page",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"default": 1,
|
|
"title": "Page"
|
|
}
|
|
},
|
|
{
|
|
"name": "page_size",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer",
|
|
"maximum": 100,
|
|
"minimum": 1,
|
|
"default": 50,
|
|
"title": "Page Size"
|
|
}
|
|
},
|
|
{
|
|
"name": "action",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Action"
|
|
}
|
|
},
|
|
{
|
|
"name": "start_date",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Start Date"
|
|
}
|
|
},
|
|
{
|
|
"name": "end_date",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "End Date"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/UsageLogsResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/guardrails/usage/overview": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Guardrails Usage Overview",
|
|
"description": "Return guardrail performance overview for the dashboard.",
|
|
"operationId": "guardrails_usage_overview_guardrails_usage_overview_get",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "start_date",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"description": "YYYY-MM-DD",
|
|
"title": "Start Date"
|
|
},
|
|
"description": "YYYY-MM-DD"
|
|
},
|
|
{
|
|
"name": "end_date",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"description": "YYYY-MM-DD",
|
|
"title": "End Date"
|
|
},
|
|
"description": "YYYY-MM-DD"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/UsageOverviewResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/guardrails/validate_blocked_words_file": {
|
|
"post": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Validate Blocked Words File",
|
|
"description": "Validate a blocked_words YAML file content.\n\nArgs:\n request: Dictionary with 'file_content' key containing the YAML string\n\nReturns:\n Dictionary with 'valid' boolean and either 'message'/'errors' depending on result\n\nExample Request:\n```json\n{\n \"file_content\": \"blocked_words:\\n - keyword: \\\"test\\\"\\n action: \\\"BLOCK\\\"\"\n}\n```\n\nExample Success Response:\n```json\n{\n \"valid\": true,\n \"message\": \"Valid YAML file with 2 blocked words\"\n}\n```\n\nExample Error Response:\n```json\n{\n \"valid\": false,\n \"errors\": [\"Entry 0: missing 'action' field\"]\n}\n```",
|
|
"operationId": "validate_blocked_words_file_guardrails_validate_blocked_words_file_post",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
},
|
|
"type": "object",
|
|
"title": "Request"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/guardrails/{guardrail_id}": {
|
|
"put": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Update Guardrail",
|
|
"description": "Update an existing guardrail\n\n\ud83d\udc49 [Guardrail docs](https://docs.litellm.ai/docs/proxy/guardrails/quick_start)\n\nExample Request:\n```bash\ncurl -X PUT \"http://localhost:4000/guardrails/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer <your_api_key>\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"guardrail\": {\n \"guardrail_name\": \"updated-bedrock-guard\",\n \"litellm_params\": {\n \"guardrail\": \"bedrock\",\n \"mode\": \"pre_call\",\n \"guardrailIdentifier\": \"ff6ujrregl1q\",\n \"guardrailVersion\": \"1.0\",\n \"default_on\": true\n },\n \"guardrail_info\": {\n \"description\": \"Updated Bedrock content moderation guardrail\"\n }\n }\n }'\n```\n\nExample Response:\n```json\n{\n \"guardrail_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"guardrail_name\": \"updated-bedrock-guard\",\n \"litellm_params\": {\n \"guardrail\": \"bedrock\",\n \"mode\": \"pre_call\",\n \"guardrailIdentifier\": \"ff6ujrregl1q\",\n \"guardrailVersion\": \"1.0\",\n \"default_on\": true\n },\n \"guardrail_info\": {\n \"description\": \"Updated Bedrock content moderation guardrail\"\n },\n \"created_at\": \"2023-11-09T12:34:56.789Z\",\n \"updated_at\": \"2023-11-09T13:45:12.345Z\"\n}\n```",
|
|
"operationId": "update_guardrail_guardrails__guardrail_id__put",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "guardrail_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Guardrail Id"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/UpdateGuardrailRequest"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Delete Guardrail",
|
|
"description": "Delete a guardrail\n\n\ud83d\udc49 [Guardrail docs](https://docs.litellm.ai/docs/proxy/guardrails/quick_start)\n\nExample Request:\n```bash\ncurl -X DELETE \"http://localhost:4000/guardrails/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer <your_api_key>\"\n```\n\nExample Response:\n```json\n{\n \"message\": \"Guardrail 123e4567-e89b-12d3-a456-426614174000 deleted successfully\"\n}\n```",
|
|
"operationId": "delete_guardrail_guardrails__guardrail_id__delete",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "guardrail_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Guardrail Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Patch Guardrail",
|
|
"description": "Partially update an existing guardrail\n\n\ud83d\udc49 [Guardrail docs](https://docs.litellm.ai/docs/proxy/guardrails/quick_start)\n\nThis endpoint allows updating specific fields of a guardrail without sending the entire object.\nOnly the following fields can be updated:\n- guardrail_name: The name of the guardrail\n- default_on: Whether the guardrail is enabled by default\n- guardrail_info: Additional information about the guardrail\n\nExample Request:\n```bash\ncurl -X PATCH \"http://localhost:4000/guardrails/123e4567-e89b-12d3-a456-426614174000\" \\\n -H \"Authorization: Bearer <your_api_key>\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"guardrail_name\": \"updated-name\",\n \"default_on\": true,\n \"guardrail_info\": {\n \"description\": \"Updated description\"\n }\n }'\n```\n\nExample Response:\n```json\n{\n \"guardrail_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"guardrail_name\": \"updated-name\",\n \"litellm_params\": {\n \"guardrail\": \"bedrock\",\n \"mode\": \"pre_call\",\n \"guardrailIdentifier\": \"ff6ujrregl1q\",\n \"guardrailVersion\": \"DRAFT\",\n \"default_on\": true\n },\n \"guardrail_info\": {\n \"description\": \"Updated description\"\n },\n \"created_at\": \"2023-11-09T12:34:56.789Z\",\n \"updated_at\": \"2023-11-09T14:22:33.456Z\"\n}\n```",
|
|
"operationId": "patch_guardrail_guardrails__guardrail_id__patch",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "guardrail_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Guardrail Id"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/PatchGuardrailRequest"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Get Guardrail Info",
|
|
"description": "Get detailed information about a specific guardrail by ID\n\n\ud83d\udc49 [Guardrail docs](https://docs.litellm.ai/docs/proxy/guardrails/quick_start)\n\nExample Request:\n```bash\ncurl -X GET \"http://localhost:4000/guardrails/123e4567-e89b-12d3-a456-426614174000/info\" \\\n -H \"Authorization: Bearer <your_api_key>\"\n```\n\nExample Response:\n```json\n{\n \"guardrail_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"guardrail_name\": \"my-bedrock-guard\",\n \"litellm_params\": {\n \"guardrail\": \"bedrock\",\n \"mode\": \"pre_call\",\n \"guardrailIdentifier\": \"ff6ujrregl1q\",\n \"guardrailVersion\": \"DRAFT\",\n \"default_on\": true\n },\n \"guardrail_info\": {\n \"description\": \"Bedrock content moderation guardrail\"\n },\n \"created_at\": \"2023-11-09T12:34:56.789Z\",\n \"updated_at\": \"2023-11-09T12:34:56.789Z\"\n}\n```",
|
|
"operationId": "get_guardrail_info_guardrails__guardrail_id__get",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "guardrail_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Guardrail Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/guardrails/{guardrail_id}/info": {
|
|
"get": {
|
|
"tags": [
|
|
"Guardrails"
|
|
],
|
|
"summary": "Get Guardrail Info",
|
|
"description": "Get detailed information about a specific guardrail by ID\n\n\ud83d\udc49 [Guardrail docs](https://docs.litellm.ai/docs/proxy/guardrails/quick_start)\n\nExample Request:\n```bash\ncurl -X GET \"http://localhost:4000/guardrails/123e4567-e89b-12d3-a456-426614174000/info\" \\\n -H \"Authorization: Bearer <your_api_key>\"\n```\n\nExample Response:\n```json\n{\n \"guardrail_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"guardrail_name\": \"my-bedrock-guard\",\n \"litellm_params\": {\n \"guardrail\": \"bedrock\",\n \"mode\": \"pre_call\",\n \"guardrailIdentifier\": \"ff6ujrregl1q\",\n \"guardrailVersion\": \"DRAFT\",\n \"default_on\": true\n },\n \"guardrail_info\": {\n \"description\": \"Bedrock content moderation guardrail\"\n },\n \"created_at\": \"2023-11-09T12:34:56.789Z\",\n \"updated_at\": \"2023-11-09T12:34:56.789Z\"\n}\n```",
|
|
"operationId": "get_guardrail_info_guardrails__guardrail_id__info_get",
|
|
"security": [
|
|
{
|
|
"APIKeyHeader": []
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "guardrail_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Guardrail Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |