# NSFW Image Detector & Image Tagger - Moderation + Categories (`pomlabs/image-moderation-tagger`) Actor

Check any image URL for nudity, sexual, violent, gory, hateful, drug, weapon and self-harm content, and get its category and tags in the same call. 14 scores, allow / review / block verdict with reasons, art and breastfeeding context, GIF frames, your own labels. No API key.

- **URL**: https://apify.com/pomlabs/image-moderation-tagger.md
- **Developed by:** [Pom Labs](https://apify.com/pomlabs) (community)
- **Categories:** AI, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 image analyzeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## NSFW Image Detector & Image Tagger

Send image URLs and get, for each one, **moderation scores, a verdict and what the image shows**, in a single call:

- **14 moderation scores** from 0 to 1: `explicit`, `suggestive`, `violence`, `gore`, `weapons`, `drugs`, `hate`, `self_harm`, `harassment`, `illegal`, `political`, `deception`, `spam`, `medical`.
- **A verdict you can act on**: `allow`, `review` or `block`, with the `reasons` that triggered it. You choose which categories block, which only ask for review, and the thresholds.
- **Nudity with context**: `nudityLevel` (`none`, `suggestive`, `explicit`) and `nudityContext` (`artistic`, `breastfeeding`, `medical`, `none`). Classical paintings and breastfeeding photos are the classic false positives of NSFW filters; here you decide whether they pass.
- **Category and tags**: main category (people, fashion, food, animals, nature, city, interior, vehicles, electronics, product, sports, art, text, events), up to 40 content tags, and the kind of image (photo, illustration, anime, render, screenshot, meme, document).
- **Signals**: `childPresent`, `hasFace`, `hasText`, `hasLogo`.
- **Your own labels**: up to 10 plain-English descriptions scored on every image ("a person wearing a helmet", "a product photo on a plain background").
- **Animated GIF and WebP**: several frames are checked and the highest score of each category is returned. Still one charge.
- **Duplicates**: `sha256`, a perceptual `phash` and `duplicateOf` when the same file appears twice in a run.

No API key, no model to host. Photos, drawings, anime and AI-generated pictures are all supported.

### Price

**$2 per 1,000 images** ($0.002 per image), everything included: moderation, category, tags, signals and custom labels. Images that cannot be downloaded or decoded are **not charged**.

### Accuracy, measured on a public benchmark

We ran the Actor's classifier on the full test split of [UnsafeBench](https://arxiv.org/abs/2405.03486) (2,037 images, half real photos and half AI-generated, labelled safe or unsafe by humans in 11 categories). November 2026:

| Category | Images | Precision | Recall | F1 |
|---|---|---|---|---|
| Sexual | 210 | 0.82 | 0.95 | 0.88 |
| Illegal activity | 171 | 0.85 | 0.84 | 0.85 |
| Political | 167 | 0.79 | 0.88 | 0.83 |
| Shocking / gore | 229 | 0.80 | 0.78 | 0.79 |
| Violence | 193 | 0.72 | 0.87 | 0.79 |
| Harassment | 187 | 0.68 | 0.80 | 0.74 |
| Hate | 197 | 0.50 | 0.52 | 0.51 |
| Self-harm | 196 | 0.41 | 0.45 | 0.43 |

Each row uses the threshold with the best F1 for that category (0.3 to 0.7), so treat the numbers as an upper bound and tune the thresholds on your own images. Hate and self-harm are the weak spots: the benchmark has only 29 unsafe images in each, and symbols and context are hard. Use `review` rather than `block` for them if false alarms cost you.

On the sexual-content images of the same benchmark, two popular open-source NSFW models scored lower: Marqo/nsfw-image-detection-384 F1 0.80 (recall 0.74) and NudeNet F1 0.57 (recall 0.41), against F1 0.88 (recall 0.95) here.

### Input

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/0/05/Glass_of_beer.jpg"
  ],
  "tagging": true,
  "customLabels": ["a product photo on a plain background"],
  "blockThreshold": "0.6",
  "reviewThreshold": "0.35",
  "blockCategories": ["explicit", "violence", "gore", "hate", "self_harm"],
  "reviewCategories": ["suggestive", "weapons", "drugs"],
  "allowArtisticNudity": false,
  "allowBreastfeeding": true,
  "maxFrames": 3
}
```

Only `imageUrls` is required. Each line is a public http(s) link to a JPEG, PNG, WebP, GIF, BMP or TIFF up to 20 MB, or a `data:` URI with base64.

How the verdict is built:

- `block`: a category in `blockCategories` scored at or above `blockThreshold`.
- `review`: a block category scored between `reviewThreshold` and `blockThreshold`, or a category in `reviewCategories` reached `blockThreshold`.
- `allow`: none of the above.

### Output

One item per image (real output of the default run):

```json
{
  "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/0/05/Glass_of_beer.jpg",
  "status": "ok",
  "verdict": "review",
  "reasons": [
    "drugs"
  ],
  "nsfw": false,
  "nudityLevel": "none",
  "nudityContext": "none",
  "scores": {"explicit": 0.02, "suggestive": 0.02, "violence": 0.02, "gore": 0.02, "weapons": 0.02, "drugs": 0.97, "hate": 0.02, "self_harm": 0.02, "harassment": 0.02, "illegal": 0.04, "political": 0.02, "deception": 0.02, "spam": 0.03, "medical": 0.09},
  "topCategory": "drugs",
  "topScore": 0.97,
  "childPresent": 0.02,
  "hasText": 0.03,
  "hasFace": 0.02,
  "hasLogo": 0.06,
  "imageKind": "photo",
  "imageKindConfidence": 1,
  "category": "food",
  "categoryConfidence": 0.99,
  "categoryScores": {"food": 0.99, "product": 0.01, "people": 0},
  "tags": [
    "drink"
  ],
  "tagScores": {"drink": 0.97, "indoor": 0.4, "food": 0.34},
  "width": 612,
  "height": 612,
  "format": "jpeg",
  "bytes": 61580,
  "animated": false,
  "frames": 1,
  "sha256": "8c891e7662979a27…",
  "phash": "04924367613332a4",
  "framesChecked": 1,
  "seconds": 0.15,
  "duplicateOf": null
}
```

With `customLabels`, each item also has `"customLabels": {"your description": score}`.

The `drugs` category includes alcohol and tobacco, which is why a glass of beer asks for review. Remove `drugs` from `reviewCategories` if that is fine on your platform.

Images that fail come back as a row with `status` (`download_failed`, `not_an_image`, `too_large`, `invalid_input`, `classifier_unavailable`) and an `error` message, and are not charged.

### What it is good for

- **User uploads**: avatars, marketplace listings, dating profiles, community posts. Block the clear cases, send the grey zone to a human with the reason attached.
- **Scraped images**: chain it after an Instagram, Reddit, Google Images or e-commerce scraper to filter or tag what you collected.
- **Catalogs**: category and tags for product photos, and custom labels for your own listing rules.
- **AI image generators**: check outputs before showing them. Half of the benchmark above is AI-generated images.
- **Ad and brand safety**: weapons, drugs, political and hateful content next to your brand.

### Limits and honest notes

- Scores are probabilities from a classifier, not a legal judgement. Keep a human in the loop for bans and appeals.
- `childPresent` tells you a person who looks under 18 is in the picture. This Actor **does not detect or report child sexual abuse material**; platforms with legal duties need a hash-matching service (PhotoDNA, Thorn Safer, NCMEC) and a reporting process.
- The Actor does not read the text inside the image; `hasText` only says there is some.
- This Actor does not store your images. Each image is downloaded, sent to the classification service and dropped; only the scores are saved, in your own dataset.
- Videos are not supported. Extract frames first with a video frame extractor Actor and send the frame URLs.

# Actor input Schema

## `imageUrls` (type: `array`):

One image per line: a public http(s) link to a JPEG, PNG, WebP, GIF, BMP or TIFF (up to 20 MB), or a data: URI with base64. Animated GIF and WebP files are checked on several frames.

## `tagging` (type: `boolean`):

Also return the main category (people, food, product, nature...), up to 40 content tags and the kind of image (photo, illustration, anime, screenshot, meme, document). Same price.

## `customLabels` (type: `array`):

Up to 10 plain-English descriptions to score from 0 to 1 on every image, for rules the standard categories do not cover. Examples: 'a person wearing a helmet', 'a product photo on a white background', 'contains a phone number or contact details'.

## `blockThreshold` (type: `string`):

Score from 0 to 1 at which a block category makes the verdict 'block'. Lower catches more and flags more safe images. Default 0.6.

## `reviewThreshold` (type: `string`):

Score from 0 to 1 at which a block category that did not reach the block threshold makes the verdict 'review'. Default 0.35.

## `blockCategories` (type: `array`):

Categories that set the verdict to 'block'. Any of: explicit, suggestive, violence, gore, weapons, drugs, hate, self_harm, harassment, illegal, political, deception, spam, medical.

## `reviewCategories` (type: `array`):

Categories that set the verdict to 'review' (never 'block') when they reach the block threshold.

## `allowArtisticNudity` (type: `boolean`):

When on, nudity in paintings, frescoes and museum sculpture does not block or flag the image (the scores and nudityContext 'artistic' are still returned).

## `allowBreastfeeding` (type: `boolean`):

When on, breastfeeding photos are not blocked or flagged for nudity.

## `maxFrames` (type: `integer`):

For animated GIF or WebP: how many frames, spread across the animation, are checked. The highest score of each category is returned. Still one charge per image.

## `concurrency` (type: `integer`):

How many images are processed at the same time. Lower it if your image host limits requests.

## Actor input object example

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/0/05/Glass_of_beer.jpg",
    "https://www.gstatic.com/webp/gallery/1.webp"
  ],
  "tagging": true,
  "blockThreshold": "0.6",
  "reviewThreshold": "0.35",
  "blockCategories": [
    "explicit",
    "violence",
    "gore",
    "hate",
    "self_harm"
  ],
  "reviewCategories": [
    "suggestive",
    "weapons",
    "drugs"
  ],
  "allowArtisticNudity": false,
  "allowBreastfeeding": true,
  "maxFrames": 3,
  "concurrency": 8
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "imageUrls": [
        "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/0/05/Glass_of_beer.jpg",
        "https://www.gstatic.com/webp/gallery/1.webp"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pomlabs/image-moderation-tagger").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "imageUrls": [
        "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/0/05/Glass_of_beer.jpg",
        "https://www.gstatic.com/webp/gallery/1.webp",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("pomlabs/image-moderation-tagger").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/0/05/Glass_of_beer.jpg",
    "https://www.gstatic.com/webp/gallery/1.webp"
  ]
}' |
apify call pomlabs/image-moderation-tagger --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pomlabs/image-moderation-tagger"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/8xPd9eCluNqE8HMU7/builds/MEyG0qSEZvmltKtXT/openapi.json
