Skip to main content

Wrap a call

guard.wrap inspects the payload, then does what onMatch says. The callback receives the payload shaped for both provider specs, so it works with any SDK.

onMatch

Set it for the whole client or for one call:
Start in allow. Watch the console for a week to see what would have been blocked, then turn on enforcement. It is the safest way to find false positives against real traffic.

The blocked response

The body mirrors an OpenAI error envelope, so a client that already handles provider errors needs no new branch.

Sanitise instead of block

guard.sanitise redacts every matched span and returns the payload shaped for both providers. Use it when a false positive costs more than a redacted instruction.
OpenAI takes the system instruction as a leading message, so it is folded into openai.messages and also exposed as openai.systemPrompt. Anthropic takes it as a top-level parameter, so it is lifted out of anthropic.messages.

Redaction rules

  • It happens on your side. The control plane returns offsets and the SDK cuts your text. The payload is never sent to FrostWolf to be rewritten.
  • Overlaps merge. A sentence that trips two rules is replaced once, not twice.
  • Structure survives. Images and other non-text parts, and provider parameters such as temperature, tools, and response_format, pass through untouched.
  • The replacement is configurable. It defaults to [REDACTED]. Set guard.replacement to change it.

Plan limits

If your plan’s allowance for semantic blocks is spent, a semantic detection is still reported but comes back as an allow, and quota.enforcementWithheld says so. In that state sanitise returns the payload as you submitted it, because the rewrite is the part the plan ran out of. Signature blocks are never withheld.