Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 84 additions & 15 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19152,7 +19152,14 @@ paths:
required: false
schema:
type: string
enum: [rpm, rph, rpd]
enum: [rpm, rph, rpd, rpw]
- name: target
in: query
description: Filter by target resource
required: false
schema:
type: string
enum: [llm, mcp_tools]
- $ref: '#/components/parameters/PageSize'
- $ref: '#/components/parameters/CurrentPage'
responses:
Expand Down Expand Up @@ -36559,16 +36566,42 @@ components:
key:
type: string
description: |
Condition key. Valid values:
- `api_key` - Apply to a specific API key
- `organisation_id` - Apply to an organization
- `workspace_id` - Apply to a workspace
- `metadata.*` - Apply based on custom metadata fields (e.g., `metadata.user_id`, `metadata.team`)
example: workspace_id
Condition key. Valid keys depend on the policy target:

**LLM policies (target: llm):**
- `api_key` - Match by API key ID
- `virtual_key` - Match by virtual key slug
- `provider` - Match by provider (e.g., `openai`, `anthropic`, `azure-openai`)
- `config` - Match by config slug
- `prompt` - Match by prompt slug
- `model` - Match by model (supports wildcards, e.g., `@openai/gpt-4o`, `@anthropic/*`)
- `endpoint_type` - Match by endpoint type (e.g., `chatComplete`, `embed`, `imageGenerate`) — rate limit policies only
- `metadata.*` - Match by request metadata (e.g., `metadata._user`, `metadata.team`)

**MCP policies (target: mcp_tools):**
- `api_key` - Match by API key ID
- `workspace_id` - Match by workspace ID
- `mcp_server` - Match by MCP server name
- `mcp_tool` - Match by MCP tool name
- `metadata.*` - Match by request metadata
example: api_key
value:
type: string
description: Condition value
example: workspace-123
oneOf:
- type: string
- type: array
items:
type: string
description: |
Value(s) to match. Use `"*"` for wildcard matching.
Can be a single string or an array of strings (OR logic for arrays).
example: "*"
excludes:
oneOf:
- type: string
- type: array
items:
type: string
description: Value(s) to exclude from matching.

GroupBy:
type: object
Expand All @@ -36578,10 +36611,23 @@ components:
key:
type: string
description: |
Group by key. Valid values:
Group by key. Each unique combination of group_by values gets its own counter.

**LLM policies (target: llm):**
- `api_key` - Group by API key
- `workspace_id` - Group by workspace
- `virtual_key` - Group by virtual key
- `provider` - Group by provider
- `config` - Group by config
- `prompt` - Group by prompt
- `model` - Group by model (uses request model name)
- `metadata.*` - Group by custom metadata fields (e.g., `metadata._user`)

**MCP policies (target: mcp_tools):**
- `api_key` - Group by API key
- `organisation_id` - Group by organization
- `workspace_id` - Group by workspace
- `mcp_server` - Group by MCP server name
- `mcp_tool` - Group by MCP tool name
- `metadata.*` - Group by custom metadata fields
example: api_key

Expand Down Expand Up @@ -36693,15 +36739,24 @@ components:
description: Policy type
unit:
type: string
enum: [rpm, rph, rpd]
enum: [rpm, rph, rpd, rpw]
description: |
Rate unit:
- `rpm` - Requests/Tokens per minute
- `rph` - Requests/Tokens per hour
- `rpd` - Requests/Tokens per day
- `rpw` - Requests/Tokens per week
value:
type: number
description: Rate limit value
target:
type: string
enum: [llm, mcp_tools]
default: llm
description: |
The target resource for rate limiting:
- `llm` - Apply rate limit to LLM requests (default)
- `mcp_tools` - Apply rate limit to MCP tool calls
workspace_id:
type: string
description: Workspace ID or slug. Required if not using API key authentication.
Expand All @@ -36719,11 +36774,17 @@ components:
description: Policy name
unit:
type: string
enum: [rpm, rph, rpd]
enum: [rpm, rph, rpd, rpw]
description: Rate unit
value:
type: number
description: Rate limit value
conditions:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Condition'
description: Array of conditions that define which requests the policy applies to

UsageLimitsPolicy:
type: object
Expand Down Expand Up @@ -36866,7 +36927,7 @@ components:
description: Policy type
unit:
type: string
enum: [rpm, rph, rpd]
enum: [rpm, rph, rpd, rpw]
description: Rate unit
value:
type: number
Expand All @@ -36891,6 +36952,14 @@ components:
type: string
format: date-time
description: Last update timestamp
target:
type: string
enum: [llm, mcp_tools]
default: llm
description: |
The target resource for rate limiting:
- `llm` - Apply rate limit to LLM requests (default)
- `mcp_tools` - Apply rate limit to MCP tool calls

CreatePolicyResponse:
type: object
Expand Down
Loading