compliance parameter.
Using Content Moderation
To enable content moderation in your API requests, simply set thecompliance parameter to true in your chat completion requests. When enabled, the API will analyze the content and return details about any detected violations.
Response Format
When compliance checking is enabled, the API response will include acompliance_violations field that contains an array of any detected content violations. Here’s an example response with detected violations:
Content Violation Categories
Our compliance system can detect and flag the following categories of potentially harmful content:| Category | Description |
|---|---|
| pedophilia | Content related to sexual content involving minors |
| beastiality | Content involving sexual acts with animals |
| murder | Content that promotes or glorifies murder |
| rape | Content related to sexual assault |
| incest | Content involving sexual relations between family members |
| gore | Explicit and graphic violent content |
| prostitution | Content promoting or soliciting prostitution |
| drug_use | Content promoting or describing drug use |
Advanced Implementation
Handling Different Violation Types
Batch Content Moderation
For applications that need to check multiple pieces of content:Best Practices
For effective content moderation in your applications:- Always enable compliance: Set
compliance: truefor all user-generated content - Implement appropriate responses: Create user-friendly notifications when content is flagged
- Pair with frontend filters: Implement basic filtering on the client side to reduce API calls for obvious violations
- Handle violations gracefully: Provide constructive feedback to users when their content is flagged
- Review edge cases: Periodically review flagged content to understand common violations in your application
- Log violations: Keep records for analysis and improvement of your moderation system
- Implement appeals process: Allow users to appeal moderation decisions when appropriate
Error Handling
Implement robust error handling for moderation requests:Integration Examples
Web Application Integration
Next Steps
Text Generation
Learn how to generate text with built-in moderation
Vision
Understand vision capabilities and content analysis
Webhooks
Set up webhooks for automated moderation workflows
API Reference
Complete API documentation and reference
