Skip to main content
This module is used to review the content input by end users and the content output by LLM in applications. It is divided into two extension point types.

Extension Points

  • app.moderation.input: End user input content review extension point
    • Used to review variable content passed in by end users and conversation input content in conversational applications.
  • app.moderation.output: LLM output content review extension point
    • Used to review content output by LLM.
    • When the LLM output is streaming, the output content will be segmented into 100-character chunks for API requests to avoid delayed reviews when output content is lengthy.

app.moderation.input

When Content Moderation > Review Input Content is enabled in applications such as Chatflow, Agent, or Chatbot, Dify will send the following HTTP POST request to the corresponding custom endpoint:

Request Body

Example:

API Response

Example:
  • action=direct_output
  • action=overridden

app.moderation.output

When Content Moderation > Review Output Content is enabled in applications such as Chatflow, Agent, or Chat Assistant, Dify will send the following HTTP POST request to the corresponding custom endpoint:

Request Body

Example:

API Response

Example:
  • action=direct_output
  • action=overridden

Code Example

Below is a piece of src/index.ts code that can be deployed on Cloudflare. (For complete Cloudflare usage, please refer to this documentation) The code works by performing keyword matching to filter both Input (content entered by users) and Output (content returned by the model). Users can modify the matching logic according to their needs.
Last modified on July 2, 2026