Skip to main content
The pii_redaction plugin modifies request and response content directly. It runs on every matching request without needing a separate rule condition.

Use cases

  • Keeping names, emails, and account numbers out of third-party provider logs.
  • Meeting data-handling requirements without rewriting prompts in every service.
  • Sending sensitive support tickets to a model while preserving the reply for the end user.
  • Excluding raw PII from trace storage while still tracing the request end to end.
The pii_redaction plugin detects personally identifiable information in the request, replaces each value with a placeholder before the provider sees it, and restores the original values in the response. The provider receives only placeholders such as <EMAIL_ADDRESS_1> or <PERSON_2>.
This feature is in Beta.

Quick start

Add a pii_redaction entry to the plugins array.

Workspace-level redaction

Enable PII redaction for every request from Settings > Plugins, without passing a plugins array on each call. Once enabled, it applies automatically to every call that doesn’t already specify a pii_redaction plugin.
Plugins settings page with a PII Redaction card showing an enable toggle, and PDF Inputs and Response Healing cards labeled Coming soon.

The Plugins settings page showing the PII Redaction toggle, with PDF Inputs and Response Healing listed as coming soon.

Once the toggle is on, a icon appears next to it. Click it to open the Configuration panel.
A request cannot turn off or reduce the workspace-level redaction settings. It can only add stricter rules of its own, such as lowering the detection threshold to redact more.

How it works

The plugin runs a redaction round-trip around the generation:
  1. Redact: detected PII in the request is replaced with typed placeholders before the request leaves the AI Gateway.
  2. Generate: the provider processes the placeholder text and returns a response that keeps the placeholders intact.
  3. Restore: the original values are substituted back into the response before it returns to the caller.
On embeddings, rerank, and images/generations, the plugin redacts the input only. The rerank response restores the echoed document text; embeddings and image generation have no echoed text to restore.
Detection runs on Orq.ai’s own model, hosted on Orq.ai infrastructure. Text is never sent to a third-party service for PII detection.

Configuration

Detection threshold

The threshold parameter sets the confidence score at which a detected value is counted as PII. The range is 0 to 1; the default is 0.5. Scores are boosted for language-specific formats (for example, a Dutch BSN scores higher when the detected or selected language is Dutch). Adjust the threshold only when there is an observed problem: lower it if real PII is being missed, raise it if too many non-PII values are being redacted.

Restrict to specific entities

Pass entities to redact only the listed types. The list is case-insensitive and must match the selected language catalog.

Failure modes

The on_failure policy decides what happens when the detection service cannot run: The detection service waits up to 90 seconds by default before timing out and applying the on_failure policy.

Supported languages

The detectable entity catalog differs per language.

Tracing

Redaction is traced in-process as child spans of the request: pii-redact for the input pass and pii-restore for the output pass. Each span carries the configured language, the failure policy, the requested entity count, the placeholder count, and the outcome. persist_redacted_to_traces controls whether the redacted (placeholder) form or the restored original is stored in trace content; it defaults to true (redacted form stored).