🎉 Introducing Model Catalog. Control every LLM your team uses. Learn More

Products

Solutions

Developers

Resources

...

🎉 Introducing Model Catalog. Control every LLM your team uses. Learn More

...

🎉 Introducing Model Catalog. Control every
LLM your team uses. Learn More

OpenAI Guardrails

Use Portkey to enforce structured inputs, safe outputs, and usage policies across all OpenAI requests.  Configure verdict actions like async checks, request denial, and feedback logging, according to your enforcement needs.

OpenAI Guardrails

OpenAI powers some of the most advanced language models in the world, including GPT-4, o3, Whisper, and DALL·E. These models are widely used for building applications across chat, summarization, code generation, document understanding, transcription, and multimodal tasks. But running them in production requires more than just model performance—it demands safety, compliance, and control.

Portkey acts as a powerful gateway layer for OpenAI, allowing you to apply customizable guardrails to every request without changing your application code. Whether you're concerned about prompt injection, data redaction, output filtering, or governance, Portkey provides a seamless way to manage and secure AI usage at scale.

With Portkey, you can:

  • Protect your AI stack from security threats with built-in guardrails

  • Route requests with precision and zero latency based on guardrail checks

  • View guardrails verdicts, latency, and pass/fail status for every check in real time.

  • Enforce org-wide AI safety policies across all your teams, workspaces and models.

  • Integrate existing guardrail infrastructure through simple webhook calls

  • Secure vector embedding requests

Portkey supports all Bedrock models out of the box and can be deployed in hours, not weeks, making it the easiest way to bring enterprise-grade control to your AI stack.

World-Class Guardrail Partners

Integrate top guardrail platforms with Portkey to run your custom policies seamlessly — from content filtering and PII detection to moderation and compliance. Ensure every AI request is safe, auditable, and aligned with your enterprise standards.

  • Mistral
    Propmt Security
    Patronus
    Pillar
    Lasso
    Pangea
    Bedrock
    Azure
  • Lasso
    Pangea
    Bedrock
    Azure
    Promptfoo
    Aporia
    Acuvity
    Exa

Guardrail checks you can apply to OpenAI

Guardrail checks you can apply to OpenAI

Guardrail checks you can apply to OpenAI

Portkey offers both deterministic and LLM-powered guardrails that work seamlessly with OpenAI’s APIs. You can apply these checks to inputs, outputs, or both.

Portkey offers both deterministic and LLM-powered guardrails that work seamlessly with OpenAI’s APIs. You can apply these checks to inputs, outputs, or both.

Portkey offers both deterministic and LLM-powered guardrails that work seamlessly with OpenAI’s APIs. You can apply these checks to inputs, outputs, or both.

Input guardrails

*

.

Regex Match

Basic

Enforce patterns on input prompts

Sentence / Word / Character Count

Basic

Control verbosity

Lowercase Detection

Basic

Control verbosity

Ends With

Basic

Validate specific prompt endings

Webhook

Basic

Enforce custom business logic

JWT Token Validator

Basic

Verify token authenticity

Model Whitelist

Basic

Allow only approved models per route

*

.

Moderate Content

Pro

Block unsafe or harmful prompts

Check Language

Pro

Enforce language constraints

Detect PII

Pro

Prevent sensitive info in prompts

Detect Gibberish

Pro

Block incoherent or low-quality input

Output guardrails

*

.

Regex / Sentence / Word / Character Count

Basic

Need content here Need content here

JSON Schema / JSON Keys

Basic

Ensure required words or phrases

Contains

Basic

Ensure required words or phrases

Valid URLs

Basic

Validate links in responses

Contains Code

Basic

Detect code in specific formats

Lowercase Detection / Ends With

Basic

Need content here Need content here

Webhook

Basic

Post-process or validate output

Detect PII / Detect Gibberish

Basic

Need content here Need content here

Partner Guardrails
Acuvity

Partner

Acuvity is a model-agnostic GenAI security solution. It is built to secure existing and future GenAI models, apps, services, tools, plugins, and more.Scan Content: Comprehensive content safety and security checks.

✓ Scan Content: Comprehensive content safety and security checks.

Acuvity

Partner

Acuvity is a model-agnostic GenAI security solution. It is built to secure existing and future GenAI models, apps, services, tools, plugins, and more.Scan Content: Comprehensive content safety and security checks.

✓ Scan Content: Comprehensive content safety and security checks.

Acuvity

Partner

Acuvity is a model-agnostic GenAI security solution. It is built to secure existing and future GenAI models, apps, services, tools, plugins, and more.Scan Content: Comprehensive content safety and security checks.

✓ Scan Content: Comprehensive content safety and security checks.

Aporia

Partner

Aporia provides state-of-the-art Guardrails for any AI workload. With Aporia, you can set up powerful, multimodal AI Guardrails.

✓ Validate Project: Check all the policies within an Aporia project

Aporia

Partner

Aporia provides state-of-the-art Guardrails for any AI workload. With Aporia, you can set up powerful, multimodal AI Guardrails.

✓ Validate Project: Check all the policies within an Aporia project

Aporia

Partner

Aporia provides state-of-the-art Guardrails for any AI workload. With Aporia, you can set up powerful, multimodal AI Guardrails.

✓ Validate Project: Check all the policies within an Aporia project

Lasso Security

Partner

Lasso Security protects your GenAI apps from data leaks, prompt injections, and other potential risks, keeping your systems safe and secure.

✓ Analyse Content - Lasso Security's Deputies analyze content for various security risks, including jailbreak attempts, custom policy violations, sexual content, hate speech, illegal content, and more.

Lasso Security

Partner

Lasso Security protects your GenAI apps from data leaks, prompt injections, and other potential risks, keeping your systems safe and secure.

✓ Analyse Content - Lasso Security's Deputies analyze content for various security risks, including jailbreak attempts, custom policy violations, sexual content, hate speech, illegal content, and more.

Lasso Security

Partner

Lasso Security protects your GenAI apps from data leaks, prompt injections, and other potential risks, keeping your systems safe and secure.

✓ Analyse Content - Lasso Security's Deputies analyze content for various security risks, including jailbreak attempts, custom policy violations, sexual content, hate speech, illegal content, and more.

Mistral

Partner

Mistral moderation service helps detect and filter harmful content across multiple policy dimensions to secure your AI applications.

✓ Moderate Content: Checks if content passes selected content moderation checks

Mistral

Partner

Mistral moderation service helps detect and filter harmful content across multiple policy dimensions to secure your AI applications.

✓ Moderate Content: Checks if content passes selected content moderation checks

Mistral

Partner

Mistral moderation service helps detect and filter harmful content across multiple policy dimensions to secure your AI applications.

✓ Moderate Content: Checks if content passes selected content moderation checks

Pangea

Partner

Pangea AI Guard helps analyze and redact text to prevent model manipulation and malicious content.

✓ AI Guard - Analyze and redact text to avoid manipulation of the model and malicious content.

Pangea

Partner

Pangea AI Guard helps analyze and redact text to prevent model manipulation and malicious content.

✓ AI Guard - Analyze and redact text to avoid manipulation of the model and malicious content.

Pangea

Partner

Pangea AI Guard helps analyze and redact text to prevent model manipulation and malicious content.

✓ AI Guard - Analyze and redact text to avoid manipulation of the model and malicious content.

Azure Guardrails

Partner

Microsoft Azure offers robust content moderation and PII redaction services that can now be seamlessly integrated with Portkey’s Guardrails ecosystem.

✓ Azure Content Safety: A comprehensive content moderation service that detects harmful content, including hate speech, violence, sexual content, and self-harm references in text.

✓ Azure PII Detection: Advanced detection of personally identifiable information (PII) and protected health information (PHI) to safeguard sensitive data.

Azure Guardrails

Partner

Microsoft Azure offers robust content moderation and PII redaction services that can now be seamlessly integrated with Portkey’s Guardrails ecosystem.

✓ Azure Content Safety: A comprehensive content moderation service that detects harmful content, including hate speech, violence, sexual content, and self-harm references in text.

✓ Azure PII Detection: Advanced detection of personally identifiable information (PII) and protected health information (PHI) to safeguard sensitive data.

Azure Guardrails

Partner

Microsoft Azure offers robust content moderation and PII redaction services that can now be seamlessly integrated with Portkey’s Guardrails ecosystem.

✓ Azure Content Safety: A comprehensive content moderation service that detects harmful content, including hate speech, violence, sexual content, and self-harm references in text.

AWS Bedrock Guardrail

Partner

AWS Bedrock provides a comprehensive solution for securing your LLM applications, including content filtering, PII detection, redaction, and more.

✓ Add contextual grounding check - Validate if model responses are grounded in the referent source and relevant to the user’s query to filter model hallucination.

✓ Add denied topic - Using a short natural language description, Guardrails helps you to define a set of topics to avoid within the context of your application.

✓ Configure content filters - The safeguard helps filter harmful multimodal content containing topics such as hate speech, insults, sex, violence, and misconduct (including criminal activity), and helps protect against prompt attacks (prompt injection and jailbreak)

✓ Add sensitive information filters - Guardrails helps you detect sensitive content such as personally identifiable information (PII) in user inputs and FM responses.

AWS Bedrock Guardrail

Partner

AWS Bedrock provides a comprehensive solution for securing your LLM applications, including content filtering, PII detection, redaction, and more.

✓ Add contextual grounding check - Validate if model responses are grounded in the referent source and relevant to the user’s query to filter model hallucination.

✓ Add denied topic - Using a short natural language description, Guardrails helps you to define a set of topics to avoid within the context of your application.

✓ Configure content filters - The safeguard helps filter harmful multimodal content containing topics such as hate speech, insults, sex, violence, and misconduct (including criminal activity), and helps protect against prompt attacks (prompt injection and jailbreak)

✓ Add sensitive information filters - Guardrails helps you detect sensitive content such as personally identifiable information (PII) in user inputs and FM responses.

AWS Bedrock Guardrail

Partner

AWS Bedrock provides a comprehensive solution for securing your LLM applications, including content filtering, PII detection, redaction, and more.

✓ Add contextual grounding check - Validate if model responses are grounded in the referent source and relevant to the user’s query to filter model hallucination.

Patronus AI

Partner

Patronus excels in industry-specific guardrails for RAG workflows.

✓ Retrieval Answer Relevance: Checks whether the answer is on-topic to the input question. Does not measure correctness.

✓ Custom Evaluator: Checks against custom criteria, based on Patronus evaluator profile name.

✓ Is Concise: Check that the output is clear and concise.

✓ Is Helpful: Check that the output is helpful in its tone of voice.

✓ Is Polite: Check that the output is polite in conversation.

✓ No Apologies: Check that the output does not contain apologies.

✓ No Gender Bias: Check whether the output contains gender stereotypes. Useful to mitigate PR risk from sexist or gendered model outputs.

✓ No Racial Bias: Check whether the output contains any racial stereotypes or not.

✓ Detect Toxicity: Checks output for abusive and hateful messages.

✓ Detect PII: Checks for personally identifiable information (PII) - this is information that, in conjunction with other data, can identify an individual.

✓ Detect PHI: Checks for protected health information (PHI), defined broadly as any information about an individual’s health status or provision of healthcare.

Patronus AI

Partner

Patronus excels in industry-specific guardrails for RAG workflows.

✓ Retrieval Answer Relevance: Checks whether the answer is on-topic to the input question. Does not measure correctness.

✓ Custom Evaluator: Checks against custom criteria, based on Patronus evaluator profile name.

✓ Is Concise: Check that the output is clear and concise.

✓ Is Helpful: Check that the output is helpful in its tone of voice.

✓ Is Polite: Check that the output is polite in conversation.

✓ No Apologies: Check that the output does not contain apologies.

✓ No Gender Bias: Check whether the output contains gender stereotypes. Useful to mitigate PR risk from sexist or gendered model outputs.

✓ No Racial Bias: Check whether the output contains any racial stereotypes or not.

✓ Detect Toxicity: Checks output for abusive and hateful messages.

✓ Detect PII: Checks for personally identifiable information (PII) - this is information that, in conjunction with other data, can identify an individual.

✓ Detect PHI: Checks for protected health information (PHI), defined broadly as any information about an individual’s health status or provision of healthcare.

Patronus AI

Partner

Patronus excels in industry-specific guardrails for RAG workflows.

✓ Retrieval Answer Relevance: Checks whether the answer is on-topic to the input question. Does not measure correctness.

Pillar Security

Partner

Pillar Security is an all-in-one platform that empowers organizations to monitor, assess risks, and secure their AI activities.

✓ Scan Prompt: Analyses your inputs for prompt injection, PII, Secrets, Toxic Language, and Invisible Character

✓ Scan Response: Analyses your outputs for PII, Secrets, and Toxic Language

Pillar Security

Partner

Pillar Security is an all-in-one platform that empowers organizations to monitor, assess risks, and secure their AI activities.

✓ Scan Prompt: Analyses your inputs for prompt injection, PII, Secrets, Toxic Language, and Invisible Character

✓ Scan Response: Analyses your outputs for PII, Secrets, and Toxic Language

Pillar Security

Partner

Pillar Security is an all-in-one platform that empowers organizations to monitor, assess risks, and secure their AI activities.

✓ Scan Prompt: Analyses your inputs for prompt injection, PII, Secrets, Toxic Language, and Invisible Character

Prompt Security

Partner

Prompt Security detects and protects against prompt injection, sensitive data exposure, and other AI security threats.

✓ Protect Prompt: Protect a user prompt before it is sent to the LLM

✓ Protect Response: Protect an LLM response before it is sent to the user

Guardrails can be configured per route, per model, or applied globally across OpenAI calls.

Prompt Security

Partner

Prompt Security detects and protects against prompt injection, sensitive data exposure, and other AI security threats.

✓ Protect Prompt: Protect a user prompt before it is sent to the LLM

✓ Protect Response: Protect an LLM response before it is sent to the user

Guardrails can be configured per route, per model, or applied globally across OpenAI calls.

Prompt Security

Partner

Prompt Security detects and protects against prompt injection, sensitive data exposure, and other AI security threats.

✓ Protect Prompt: Protect a user prompt before it is sent to the LLM

How to add guardrails to OpenAI with Portkey

Putting Portkey Guardrails in production is just a 4-step process:

Step 3

Enable Guardrail through Configs

Step 4

Attach the Config to a Request
1

Step 1

Create Guardrail Checks

Step 2

Create Guardrail
Actions

Create Guardrail Actions
2
3
4
1
2
3
4

Step 1

Step 1

Create Guardrail Checks

Create Guardrail Checks

Step 2

Step 2

Create Guardrail
Actions

Create Guardrail Actions

Step 3

Step 3

Enable Guardrail through Configs

Enable Guardrail through Configs

Step 4

Step 4

Attach the Config to a Request

Attach the Config to a Request

Guardrail action settings

Guardrail action settings

Async (TRUE)

Run guardrails in parallel to the request.

→ No added latency. Best for logging-only scenarios.

Async (TRUE)

Run guardrails in parallel to the request.

→ No added latency. Best for logging-only scenarios.

Async (TRUE)

Run guardrails in parallel to the request.

→ No added latency. Best for logging-only scenarios.

Async (FALSE)

Run guardrails before request or response.

→ Adds latency. Use when the guardrail result should influence the flow.

Async (FALSE)

Run guardrails before request or response.

→ Adds latency. Use when the guardrail result should influence the flow.

Async (FALSE)

Run guardrails before request or response.

→ Adds latency. Use when the guardrail result should influence the flow.

Deny Request (TRUE)

Block the request or response if any guardrail fails.

→ Use when violations must stop execution.

Deny Request (TRUE)

Block the request or response if any guardrail fails.

→ Use when violations must stop execution.

Deny Request (TRUE)

Block the request or response if any guardrail fails.

→ Use when violations must stop execution.

Deny Request (FALSE)

Allow the request even if the guardrail fails (returns 246 status).

→ Good for observing without blocking.

Deny Request (FALSE)

Allow the request even if the guardrail fails (returns 246 status).

→ Good for observing without blocking.

Deny Request (FALSE)

Allow the request even if the guardrail fails (returns 246 status).

→ Good for observing without blocking.

Send Feedback on Success/Failure

Attach metadata based on guardrail results.

→ Recommended for tracking and evaluation.

Send Feedback on Success/Failure

Attach metadata based on guardrail results.

→ Recommended for tracking and evaluation.

Send Feedback on Success/Failure

Attach metadata based on guardrail results.

→ Recommended for tracking and evaluation.

Latest guides and resources

Guardrails on the Gateway Framework

About a year ago, we started Portkey to solve a problem we'd faced ourselves — lack of adequate tooling...

Production Guardrails for AI Apps

LLM outputs are still unreliable. Some of it is fixed with having strong AI guardrails that scan your inputs & outputs and fix...

Types of AI Guardrails and When to Use Them

A technical guide to implementing AI guardrails - covering input validation

Latest guides and resources

Guardrails on the Gateway Framework

About a year ago, we started Portkey to solve a problem we'd faced ourselves — lack of adequate tooling...

Production Guardrails for AI Apps

LLM outputs are still unreliable. Some of it is fixed with having strong AI guardrails that scan your inputs & outputs and fix...

Types of AI Guardrails and When to Use Them

A technical guide to implementing AI guardrails - covering input validation

Latest guides and resources

Guardrails on the Gateway Framework

About a year ago, we started Portkey to solve a problem we'd faced ourselves — lack of adequate tooling...

Production Guardrails for AI Apps

LLM outputs are still unreliable. Some of it is fixed with having strong AI guardrails that scan your inputs & outputs and fix...

Types of AI Guardrails and When to Use Them

A technical guide to implementing AI guardrails - covering input validation

Frequently Asked Questions

Some questions we get asked the most

Do guardrails add latency to requests?
Do guardrails add latency to requests?
Do guardrails add latency to requests?
Can I block a request if a guardrail fails?
Can I block a request if a guardrail fails?
Can I block a request if a guardrail fails?
What happens if I don’t want to block, just observe?
What happens if I don’t want to block, just observe?
What happens if I don’t want to block, just observe?
Are OpenAI Guardrails only for inputs?
Are OpenAI Guardrails only for inputs?
Are OpenAI Guardrails only for inputs?
What’s the difference between basic and pro guardrails?
What’s the difference between basic and pro guardrails?
What’s the difference between basic and pro guardrails?

Safeguard your OpenAI requests now.

Safeguard your OpenAI requests now.

Safeguard your OpenAI requests now.

Whether you're building with GPT-4o, running production workloads, or scaling across teams, Portkey’s guardrails give you control without compromise.

Manage models, monitor usage, and fine-tune
settings—all in one place.

Whether you're building with GPT-4o, running production workloads, or scaling across teams, Portkey’s guardrails give you control without compromise.