Who can use this feature: Anyone on any plan who uses OpenAI as their provider.

Introduction

By integrating with OpenAI’s moderation endpoint, Helicone helps you check whether the user message is potentially harmful.

Why Moderations

  • Identifying harmful requests and take action, for example, by filtering it.
  • Ensuring any inappropriate or harmful content in user messages is flagged and prevented from being processed.
  • Maintaining the safety of the interactions with your application.

Getting Started

To enable moderation, set Helicone-Moderations-Enabled to true.

The moderation call to the OpenAI endpoint will utilize your provided OpenAI API key.

Error Repsonse

If the message is flagged, the response will have a 400 status code. It’s crucial to handle this response appropriately.

If the message is not flagged, the proxy forwards it to the chat completion endpoint, and the process continues as normal.

Here’s an example of the error response when flagged:

{
  "success": false,
  "error": {
    "code": "PROMPT_FLAGGED_FOR_MODERATION",
    "message": "The given prompt was flagged by the OpenAI Moderation endpoint.",
    "details": "See your Helicone request page for more info: https://www.helicone.ai/requests?[REQUEST_ID]"
  }
}

Coming Soon

We’re continually expanding our moderation features. Upcoming updates include:

  • Customizable moderation criteria