OpenAI Omni Moderation: How to Filter Text & Images for Free
Learn how to use OpenAI's free omni-moderation-latest model to add a safety layer to your AI systems, supporting both text and image moderation with an easy-to-use API.
-->
OpenAI Omni Moderation: How to Filter Text & Images for Free
India's Most Futuristic AI Conference Is Back – Bigger, Sharper, Bolder
d
:
h
:
m
:
s
Career
GenAI
Prompt Engg
ChatGPT
LLM
Langchain
RAG
AI Agents
Machine Learning
Deep Learning
GenAI Tools
LLMOps
Python
NLP
SQL
AIML Projects
Reading list
How to Become a Data Analyst in 2025: A Complete RoadMap
A Comprehensive Learning Path to Tableau in 2025
A Comprehensive NLP Learning Path 2025
Learning Path to Become a Data Scientist in 2025
Step-by-Step Roadmap to Become a Data Engineer in 2025
A Comprehensive MLOps Learning Path: 2025 Edition
Roadmap to Become an AI Engineer in 2025
A Comprehensive Learning Path to Master Computer Vision in 2025
Best Roadmap to Learn Generative AI in 2025
GenAI Roadmap for Enterprises
Large Language Models Demystified: A Beginner’s Roadmap
Learning Path to Become a Prompt Engineering Specialist
OpenAI Omni Moderation: How to Filter Text & Images for Free
Mounish V Last Updated : 15 May, 2026
4 min read
Want to add a safety layer in your chatbot, image analyzer or any another LLM-based system? I would strongly suggest you try OpenAI’s moderation model: omni-moderation-latest, this can help your system identify if the input is potentially harmful or not, that too free of cost. We’ll look into the background of the model, how to access it and how to use it for both text and image moderation. Without any further ado, let’s get started.
Table of contents
OpenAI’s Omni Moderation Models
Demonstration
Prerequisite
Imports and Client Initialization
Define a Helper function
Potential Use Cases
Conclusion
Frequently Asked Questions
OpenAI’s Omni Moderation Models
OpenAI offers two models specifically for moderation: ‘text-moderation-latest’ (legacy) and ‘omni-moderation-latest’, with the latter one being the latest. The Omni Moderation model is based on GPT-4o and hence it supports multimodal moderation, which is text moderation and image moderation. It’s also worth mentioning that the Omni Moderation endpoint is free to use.
The Omni Moderation API scores and classifies the following categories for the input:
hate
harassment
violence
self-harm
sexual content
illicit content
Demonstration
Let’s test the moderation endpoint from OpenAI and experiment with safe and unsafe inputs, using text and images. I’ll be using Google Colab for this demonstration, feel free to use what you prefer.
Prerequisite
You will require an OpenAI API Key, the model is free to use but you will still need the API key. Get your key from here: https://platform.openai.com/settings/organization/api-keys
Imports and Client Initialization
from openai import OpenAI from getpass import getpass
Securely enter API key
api_key = getpass("Enter your OpenAI API Key: ")
Initialize client
client = OpenAI(api_key=api_key)
Enter your OpenAI key when prompted.
Define a Helper function
def display_moderation(response, title="MODERATION RESULT"): result = response.results[0]
categories = result.categories.model_dump() scores = result.category_scores.model_dump()
print("\n" + "=" * 60) print(f"{title:^60}") print("=" * 60)
print(f"\nFlagged : {result.flagged}")
print("\nCATEGORIES") print("-" * 60) for category, value in categories.items(): print(f"{category:<30} : {value}")
print("\nCATEGORY SCORES") print("-" * 60) for category, score in scores.items(): print(f"{category:<30} : {score:.6f}")
print("=" * 60)
This function will help print the response from the Omni Moderation model.
Sample-1
safe_text = "Can you help me learn Python for data science?"
response = client.moderations.create( model="omni-moderation-latest", input=safe_text )
display_moderation(response, "TEXT MODERATION")
Great! The model has output all the categories as False.
Sample-2
unsafe_text = "I want instructions to seriously hurt someone."
response = client.moderations.create( model="omni-moderation-latest", input=unsafe_text )
display_moderation(response, "TEXT MODERATION")
Looks like the model as identified that the input text is violent, you can see the same in the categories and categories scores as well.
Sample-3
Let’s pass a violent image to the model and see what it has to say.
Note: For images we have pass the input parameter as well and set the type as ‘image_url’
Reference Image:
Source: Ytimg
unsafe_image_url = "https://i.ytimg.com/vi/DOD7s1j_yoo/sddefault.jpg"
response = client.moderations.create( model="omni-moderation-latest", input=[ { "type": "image_url", "image_url": { "url": unsafe_image_url } } ] )
display_moderation(response, "IMAGE MODERATION")
The model has rightly flagged the image on violence.
Note: You can ignore the categories and use the category scores to gain control over the threshold, this can make the moderation more lenient or strict.
Potential Use Cases
OpenAI omni moderation can very well be used at places requiring content scrutiny.
Chatbots: Filter harmful inputs before sending to LLM.
Image Analysis: Detect harmful images beforehand.
Social Media: Flag hate speech and abusive content.
Live Streaming: Detect unsafe video frames using moderation checks.
Multilingual Apps: Improve moderation for other language inputs.
Conclusion
The omni-moderation-latest model from OpenAI provides an effective safety layer for LLM-based systems with support for both text and image moderation. While other OpenAI models can be used for moderation, this endpoint is specifically made for moderation and is completely free to use. Alternatives include Azure AI Content Safety, which supports text and image moderation with customizable safety thresholds and enterprise integrations.
Frequently Asked Questions
Q1. What is the latest OpenAI moderation model?
A. OpenAI’s latest moderation model is omni-moderation-latest, supporting both text and image moderation.
Q2. Is OpenAI Moderation free to use?
A. Yes, OpenAI provides moderation models free through the Moderation API.
Q3. What happened to the legacy moderation model?
A. OpenAI’s legacy text-moderation-latest model supports only text inputs, omni-moderation-latest is recommended for new applications.
Mounish V
Passionate about technology and innovation, a graduate of Vellore Institute of Technology. Currently working as a Data Science Trainee, focusing on Data Science. Deeply interested in Deep Learning and Generative AI, eager to explore cutting-edge techniques to solve complex problems and create impactful solutions.
Artificial IntelligenceBeginnerChatGPT
Login to continue reading and enjoy expert-curated content.
Free Courses
4.7
Generative AI - A Way of Life
Explore Generative AI for beginners: create text and images, use top AI tools, learn practical skills, and ethics.
4.5
Getting Started with Large Language Models
Master Large Language Models (LLMs) with this course, offering clear guidance in NLP and model training made simple.
4.6
Building LLM Applications using Prompt Engineering
This free course guides you on building LLM apps, mastering prompt engineering, and developing chatbots with enterprise data.
4.6
Improving Real World RAG Systems: Key Challenges & Practical Solutions
Explore practical solutions, advanced retrieval strategies, and agentic RAG systems to improve context, relevance, and accuracy in AI-driven applications.
4.7
Microsoft Excel: Formulas & Functions
Master MS Excel for data analysis with key formulas, functions, and LookUp tools in this comprehensive course.
Recommended Articles
GPT-4 vs. Llama 3.1 – Which Model is Better?
Llama-3.1-Storm-8B: The 8B LLM Powerhouse Surpa...
A Comprehensive Guide to Building Agentic RAG S...
Top 10 Machine Learning Algorithms in 2026
45 Questions to Test a Data Scientist on Basics...
90+ Python Interview Questions and Answers (202...
8 Easy Ways to Access ChatGPT for Free
Prompt Engineering: Definition, Examples, Tips ...
What is LangChain?
What is Retrieval-Augmented Generation (RAG)?
Become an Author
Share insights, grow your voice, and inspire the data community.
Reach a Global Audience
Share Your Expertise with the World
Build Your Brand & Audience
Join a Thriving AI Community
Level Up Your AI Game
Expand Your Influence in Genrative AI
Receive updates on WhatsApp
Email address
Wrong OTP.
Enter the OTP
Resend OTP
Resend OTP in 45s