Skip to main content
Use Cases
  • Keeping system prompts out of stored traces while still tracing the request.
  • Excluding user-submitted content from logs to meet data-handling requirements.
  • Redacting model output from traces without changing what the caller receives.
The security parameter controls what gets written to stored traces. It does not change the live request or response: the caller always receives the full, unmasked output. Only the copy persisted to trace storage is affected.
Masking input, output, system, or all with security.mask only affects the copy of the request written to stored traces. The full, unmasked payload is still sent to the model provider. To prevent PII from leaving in the live request or response, enable the PII Redaction plugin.
security is set per request. There is no workspace, project, or API-key default, so a request that sends no security block is traced in full unless a workspace-level mask applies. To mask every request without repeating the field, enable Trace Scrubbing for the workspace: its masks are merged with the request’s, and a request can add to them but not reduce them. To attach the field automatically instead, set it as a default on the SDK client.

Quick Start

Configuration

An unrecognized value in mask is rejected with a 400 error.

What each value masks

Coverage

security is supported across the AI Gateway’s endpoints, including responses, chat/completions, completions, embeddings, images, ocr, rerank, speech, transcriptions, and translations. security is unrelated to the PII Redaction plugin, which rewrites sensitive values in the live request and response, and to Guardrails, which can block a request outright. security only changes what is written to trace storage, which it shares with the Trace Scrubbing plugin; the two are merged, and Trace Scrubbing can also be set for a workspace or a routing rule.