Skip to main content

Choosing a Guardrail Provider

Guardrails enforce content policy before a request reaches an upstream model, after the model responds, or at both hook points. Choose a guardrail based on where content can be evaluated, what it must detect, and whether matching content should be blocked or masked.

Before configuring a provider, review Guardrail Behavior to choose hook points, enforcement, scoping, and failure policies. Then use the provider's setup guide to configure credentials, detection rules, and verification requests.

Provider Comparison

Use the comparison to identify where a guardrail evaluates content and whether it supports the action your policy requires:

KindProviderEvaluation LocationDetectsActions
keywordBuilt-inInside AISIXLiteral and regular-expression patternsBlock
piiBuilt-inInside AISIXRule-based PII, such as email addresses, phone numbers, IDs, cards, keys, and custom patternsMask or block
presidioMicrosoft PresidioSelf-hosted Presidio serviceRule-based and NER/ML PII entities, such as PERSON and LOCATIONMask with replace, mask, hash, or redact operators; or block
lakeraLakera GuardLakera APIPrompt injection, jailbreaks, unsafe content, and PIIBlock; mask PII-only detections
azure_content_safetyAzure AI Content SafetyAzure APIPrompt injection and jailbreaks through Prompt ShieldBlock
azure_content_safety_text_moderationAzure AI Content SafetyAzure APIHate, sexual, self-harm, and violence severity categories, plus blocklistsBlock
openai_moderationOpenAI ModerationOpenAI APIHarassment, hate, violence, sexual, self-harm, and other content categoriesBlock
bedrockAWS Bedrock GuardrailsAWS Bedrock serviceContent filters, denied topics, sensitive information, and word filtersBlock; mask PII configured with ANONYMIZE
aliyun_text_moderationAlibaba Cloud Content ModerationAlibaba Cloud APIRisk-level content moderationBlock
aliyun_ai_guardrailAlibaba Cloud AI GuardrailsAlibaba Cloud APIConsole-policy composite checks: content compliance, prompt attacks, and sensitive dataBlock; mask sensitive data per console policy

Every listed guardrail can inspect caller requests, model responses, or both. Guardrail Behavior explains their shared hook points, enforcement modes, scoping, streaming behavior, failure handling, and caller responses.

Choose a Guardrail by Goal

After narrowing the available providers, match the policy goal to a practical starting point:

GoalStart WithConsider Also
Detect or redact PIIBuilt-in PII, which runs inside AISIX and supports rule-based detectors plus custom patterns.Presidio for entities that regular expressions cannot express, such as names, locations, or nationalities. Presidio also supports self-hosted evaluation and hash or placeholder replacement. Consider AWS Bedrock or Lakera when you already use those providers.
Detect prompt injection and jailbreaksLakera Guard or Azure Prompt Shield.Attach both when a security review requires independent providers. Both can screen indirect injection carried in retrieved documents or tool results included in a conversation.
Moderate content categoriesOpenAI Moderation for its standard category set.Azure Text Moderation for per-category severity thresholds and server-side blocklists, or the Alibaba Cloud guardrails within that provider ecosystem — AI Guardrails for console-managed composite policy with sensitive-data masking, Content Moderation for AISIX-side risk thresholds.
Enforce organization-specific rulesBuilt-in keyword guardrail.Match literal or regular-expression patterns without an external dependency.

Detection-based guardrails can produce false positives and false negatives, so evaluate a new policy in monitor mode before enforcing it on production traffic. See Guardrail Behavior.

What the Gateway Records

Guardrail telemetry varies by endpoint. Where supported, usage records identify applied guardrails, monitor-mode observations, blocked decisions, and remote fail-open bypass reasons. Not every endpoint populates every field.

Usage records and caller-facing error responses do not include the matched request or response body. Operator logs can include the matched literal or regular-expression rule for a built-in keyword block. The provider guides show the redaction tokens and block-response shapes for each guardrail kind.

Next Steps

Review Guardrail Behavior, then open the selected provider's setup guide from the comparison table.