Image Moderation
BETAAnalyze images for potential moderation issues.
POST
https://api.safecomms.dev/moderation/imageBETAThe image moderation endpoint allows you to scan images for unsafe content such as nudity, violence, gore, and hate symbols.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| image | string | Yes | The image to moderate. Can be a public URL or a Base64 encoded string. |
| language | string | No | The language to use for the explanation (default: "English"). |
| moderationProfileId | string | No | The ID of a custom moderation profile to apply. |
| enableOcr | boolean | No | Extract visible English text from the image (OCR). Default: false. |
| enhancedOcr | boolean | No | Allocates extra resources for maximum accuracy. Slower and rarely needed for standard images. Requires `enableOcr` to be true. Default: false. |
| extractMetadata | boolean | No | Extract EXIF metadata from the image. Default: false. |
URL Restrictions
When providing a URL for the image field, please note the following restrictions:
- Download Timeout: The image must download within 5 seconds.
- Redirect Limit: A maximum of 3 redirects are followed.
- Protocols: Only HTTP and HTTPS are supported.
- Security: URLs resolving to internal or private IP addresses are immediately skipped since we cannot access them.
We enforce these restrictions to ensure a high level of quality and reliability for our service. If you have any questions or concerns, please contact our helpdesk.
Token Usage & Costs
Image moderation uses a base cost of 20 tokens per request.
| Feature | Cost | Tier | Condition |
|---|---|---|---|
| Base Request | 20 Tokens | Starter+ | Always applied. |
| Non-English Language | +1 | Pro+ | Applied when language is not 'English'. |
| Optical Character Recognition (OCR) | +3 | Pro+ | Applied when enableOcr is true. |
| Enhanced OCR | +8 | Pro+ | Applied when enhancedOcr is true. Replaces standard OCR cost. Note: Slower and rarely needed for standard images. |
| EXIF (Metadata) | +1 | Starter+ | Applied when extractMetadata is true. |
Example Request
{
"image": "https://example.com/image.jpg",
"language": "English",
"enableOcr": true,
"extractMetadata": true
}Example Response
{
"isClean": false,
"confidence": 95,
"severity": "High",
"categoryScores": {
"Profanity": "None",
"Slurs": "None",
"Sexual": "High",
"Hate": "None",
"Spam": "None",
"Bullying": "None",
"Violence": "None"
},
"isBypassAttempt": false,
"issues": [
{
"term": "Nudity",
"context": "Explicit content detected"
}
],
"reason": "Contains explicit sexual content.",
"detectedText": [
"WARNING",
"ADULT CONTENT"
],
"metadata": {
"Make": "Canon",
"Model": "Canon EOS 5D Mark IV",
"DateTime": "2023:10:27 14:30:00"
}
}