
The Moderation API checks text for policy violations — a free tool to keep harmful content out of your application.
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}")Run moderation on all user inputs before sending to the main model. It's free and adds important safety protection.
Reference:
TaskLoco™ — The Sticky Note GOAT