Skip to main content

Policies API

Policies allow you to control how Perf routes requests and handles content. Set model preferences, enforce cost limits, detect PII, and filter sensitive terms.

Why Policies?

  • Cost Control: Set budget limits and prefer cheaper models
  • Compliance: Block specific providers or require certain models
  • Security: Detect and redact PII from outputs
  • Governance: Monitor and control content with term filtering

Policy Types

Policy Templates API

Get pre-built policy templates to quickly enable common configurations.

List Templates

Response:

Get Template by Slug

Example:

Available Templates

Routing Templates

Content Templates (Pro+)

Routing Policy Options

Configure how Perf selects models: Example - Google Only Policy:

Content Policy Options

Configure content filtering and PII detection: Example - PII Protection Policy:

Supported PII Types

Violation Actions

Policy Blocked Response

When a request is blocked by a hard_block policy:

Managing Policies via Dashboard

Policies are configured per-project in the Perf Dashboard:
  1. Navigate to Configure > Policies
  2. Click Create Policy or Apply Template
  3. Configure rules and violation actions
  4. Set priority (lower number = higher priority)
  5. Enable the policy
Multiple policies can be active simultaneously. They are evaluated in priority order.

Plan Limits