🎓 All Courses | 📚 OpenAI API University Syllabus
Stickipedia University
📋 Study this course on TaskLoco

The Moderation API checks text for policy violations — a free tool to keep harmful content out of your application.

How to Use It

response = client.moderations.create(
    input="User's message here"
)

result = response.results[0]
if result.flagged:
    # Block this content
    categories = result.categories
    print(f"Flagged: {categories}")

What It Detects

  • Hate speech, harassment
  • Violence and graphic content
  • Self-harm content
  • Sexual content
  • Illicit activity

Best Practice

Run moderation on all user inputs before sending to the main model. It's free and adds important safety protection.


YouTube • Top 10
OpenAI API University: Moderation API — Keep Your App Safe
Tap to Watch ›
📸
Google Images • Top 10
OpenAI API University: Moderation API — Keep Your App Safe
Tap to View ›

Reference:

Moderation API documentation

image for linkhttps://en.wikipedia.org/wiki/Special:Search?search=Moderation%20API

📚 OpenAI API University — Full Course Syllabus
📋 Study this course on TaskLoco

TaskLoco™ — The Sticky Note GOAT