Overview
The Text Moderation API uses advanced AI models to automatically detect and identify potential risks in text content, helping you build safe and compliant applications.Supports OpenAI Moderation models and other mainstream content moderation models with high accuracy and fast response.
Key Capabilities
Violation Detection
Identify violations like violence, pornography, and hate
Harmful Content Filter
Detect harmful information like self-harm, harassment, fraud
Multilingual Support
Support moderation in Chinese, English, and other languages
Fine-grained Classification
Provide detailed violation categories and confidence scores
Quick Start
Basic API Call
Use the Moderation API to detect if text content violates policies:Batch Detection Example
Detect multiple texts at once:Moderation Categories
OpenAI Moderation Supported Categories
Response Structure
Response Format
Field Descriptions
flagged
Boolean indicating if violations detected
categories
Binary judgment results for each category
category_scores
Confidence scores for each category (0-1)
Integration Examples
Chat Content Moderation
Integrate content moderation in chat applications:UGC (User-Generated Content) Filtering
Filter user content in forums, comments, etc.:AI-Generated Content Moderation
Secondary moderation for AI-generated content:Advanced Usage
Custom Moderation Thresholds
Adjust moderation strictness based on business needs:Moderation Logging
Record moderation history for analysis and improvement:Multi-Model Joint Moderation
Combine multiple moderation models for higher accuracy:Best Practices
1. Bidirectional Moderation
Input Moderation
Moderate user input to prevent malicious requests
Output Moderation
Moderate AI-generated content to ensure safe output
2. Asynchronous Moderation
Use asynchronous moderation for non-real-time scenarios to improve performance:3. Cache Moderation Results
Cache moderation results for identical content to reduce API calls:4. Tiered Handling
Take different actions based on violation severity:FAQ
Does moderation support Chinese?
Yes. OpenAI Moderation and other mainstream moderation models support Chinese content moderation with accuracy comparable to English.What is the moderation latency?
Typically between 100-500ms, depending on:- Text length
- Model selection
- Network conditions
How to handle false positives?
Recommend a tiered strategy:- High confidence violations: Direct rejection
- Medium confidence: Manual review
- Low confidence: Allow or warn
Is moderation charged?
OpenAI Moderation API is currently free. Other models may charge fees. See Pricing for details.Can images and videos be moderated?
Current Moderation API mainly targets text content. Image and video moderation require specialized multimodal moderation models.Related Documentation
Text Generation
Chat Completions API documentation
Content Safety
Platform content safety policies
Pricing
Moderation API pricing details