> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-audit-content-webhooks.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Use OpenAI moderation with CometChat to detect harmful messages, configure prompts, choose models, and apply moderation actions.

CometChat offers AI-powered message moderation to help maintain a safe and respectful chat environment. You can choose between two AI moderation options: **OpenAI Moderation** (configured entirely in the dashboard, described below) and the [Custom API](/moderation/custom/custom-api-overview) approach, which lets you bring your own moderation service or model. OpenAI moderation is one of the rule types available in CometChat's [moderation rules engine](/moderation/rules-management) — if you are new to moderation, start with the [moderation Getting Started guide](/moderation/getting-started).

### **OpenAI Moderation**

Leverage OpenAI’s AI models to automatically detect and filter offensive, harmful, or inappropriate messages in real time. This option allows you to:

* **Define Custom Prompts** – Set specific prompts to classify and moderate messages based on your needs.
* **Choose an AI Model** – Select the OpenAI model that best suits your moderation requirements.
* **Contextual Moderation** – Configure how many previous messages from the conversation should be considered for better contextual understanding.
* **Flexible Moderation Actions** – Block, allow, or take fallback actions if the API request fails.
* **Secure API Management** – Provide and manage OpenAI credentials directly in the CometChat dashboard.

This moderation provides flexibility to enhance user safety and compliance within your chat platform.

## How it works

When a message is sent, CometChat evaluates it against your enabled moderation rules. For an OpenAI rule, CometChat sends the message (optionally with recent conversation history for context) to OpenAI using the prompt and model you configured, then applies the action you defined — block, flag for review, or allow — based on the confidence threshold. If the OpenAI request fails, CometChat falls back to the behavior you selected (approve or block).

Setting OpenAI moderation up involves three dashboard steps: creating an **OpenAI Prompt** list, configuring the **OpenAI model and API key** in Advanced Settings, and mapping the list to a **moderation rule**.

<Card title="Set up OpenAI Moderation" icon="sliders" href="/moderation/open-ai/openai-custom">
  Step-by-step configuration: create the prompt list, set the model and API key, and create the rule.
</Card>

## Next steps

<CardGroup cols={2}>
  <Card title="Moderation Overview" icon="shield" href="/moderation/overview">
    Understand the full moderation feature set.
  </Card>

  <Card title="Getting Started" icon="play" href="/moderation/getting-started">
    Set up moderation rules and integration.
  </Card>

  <Card title="Rules Management" icon="gavel" href="/moderation/rules-management">
    Create and manage moderation rules.
  </Card>

  <Card title="Custom API Moderation" icon="code" href="/moderation/custom/custom-api-overview">
    Bring your own moderation service or model.
  </Card>
</CardGroup>
