NSFW Detection API vs LLM Vision: I Tested the Traps

Last Updated: 2026-07-21 10:45:36

Every NSFW detection API catches obvious porn. They split on false positives, wrongly flagging swimsuits, art, or medical photos as explicit, and that is what should decide your pick. So I tested a dedicated detector against three LLM vision models on the same borderline images: the cheap detector flagged a marble statue as nudity in 26ms, while the stronger LLMs read the context and passed it. The setup most teams should copy is a cheap detector on every upload, then only the ambiguous cases sent to an LLM for a second look, which keeps roughly $1-per-1,000 economics while cutting the false alarms that anger real users.

What an NSFW detection API actually returns

Before comparing tools, know what comes back. You send an image (as a URL or a direct upload) and get a probability score from 0.0 to 1.0, plus per-category labels: usually nudity, suggestive, and violence, with some services adding hentai, gore, drugs, or weapons. You choose a threshold. Scores above it get blocked, a middle band gets queued for a human, the rest passes.

That 0–1 score is the whole game. Set the threshold too low and you bury moderators in false alarms; too high and unsafe content reaches users. Most services score still images; fewer handle video (by sampling frames at an interval you set) or text. Keep that vocabulary in mind. It's the difference between the options below.

The options, and what each is good at

The market splits into four groups, and they solve different problems.

Dedicated moderation APIs

Purpose-built classifiers from Sightengine, Hive Moderation, AWS Rekognition, Google Cloud Vision, and Azure AI Content Safety. These are fast (sub-second to ~1s), cheap per image, and offer category granularity plus video support on the higher tiers. Hive advertises 50+ classes; Sightengine quotes sub-100ms responses.

Sightengine pricing page showing Starter and Pro content-moderation plans

The free built-in option: OpenAI Moderation

OpenAI's Moderation endpoint (omni-moderation-latest) is free to use and accepts both text and images up to 20 MB. It returns 13 categories, including a dedicated sexual/minors flag, each with a boolean and a 0–1 confidence score. Since it's free, it's the quickest option to benchmark first:

curl https://api.openai.com/v1/moderations \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"omni-moderation-latest",
       "input":[{"type":"image_url","image_url":{"url":"https://example.com/upload.jpg"}}]}'

Self-hosted open source

NudeNet and the Falconsai/nsfw_image_detection model both run locally in Python, with no per-call fee, and image data never leaves your infrastructure. NudeNet is two lines to try:

from nudenet import NudeDetector
NudeDetector().detect("upload.jpg")
# -> [{'class': 'FEMALE_BREAST_EXPOSED', 'score': 0.91, 'box': [...]}, ...]

The open-source safe-content-ai project wraps Falconsai in a Docker FastAPI service you can deploy with one command. The trade-off is scope (these focus on nudity or a simple binary) and ops: you own the uptime, GPU, and updates.

Multimodal LLM vision via a relay

Vision models (GPT, Claude, GLM, doubao) can classify an image from a plain prompt. This is the flexible option: you change policy by editing the prompt, you get a written reason for each verdict, and you can invent custom categories on the spot. You pay per token and wait a few seconds. It's the option rarely benchmarked against the dedicated tools, so that's where I focused the test.

Pricing and what each is best for

Checked against each vendor's own pricing page in July 2026:

ProviderPriceFree tierBest for
OpenAI ModerationFreeNo per-call feeA zero-cost baseline, or teams already on OpenAI
AWS Rekognition$1 / 1,000 images1,000/mo (trial)Cheapest at scale; AWS stack; image + video
Google Cloud Vision$1.50 / 1,000 ($0.60 at volume)1,000/moGCP stack
Sightengine$29/mo = 10k ops, then $0.002/opTrialLowest latency; video and live-stream
Hive Moderation~$1–5 / 1,000Deepest category set (50+ classes)
Azure AI Content Safety~$1.50 / 1,0005,000/moSeverity scoring; Azure stack
NudeNet / FalconsaiFree (self-host)Privacy; zero per-call cost
LLM vision (via relay)~$0.0003–0.03 / imageContext-sensitive review layer

I tested the false positives: dedicated detector vs LLM vision

Vendors publish accuracy numbers. JigsawStack claims over 98%, and "95%+" is a common line. But raw accuracy hides the failure that generates support tickets: false positives on safe content. So I built a three-image test set, all safe for work, and ran the same images through both a dedicated open-source detector (NudeNet) and three multimodal vision models. A control office photo, a woman in a modest one-piece swimsuit, and a classical nude marble statue, with the two "traps" being exactly the images a blunt nudity detector over-flags.

First-hand NSFW moderation test set: office control, modest swimwear, and a classical nude statue

For the LLM models I used one prompt: *"You are an image content-moderation classifier. Return strict JSON: verdict (safe/flag/block), nsfw_score 0–1, categories {nudity, suggestive, violence}, reason. Use block only for explicit sexual content; flag means needs human review."* NudeNet returns per-body-part boxes with confidence scores, so I took the top exposed-part score as its nudity score. The results:

ModelOffice (control)SwimwearClassical statue
NudeNet (dedicated, self-host)safe · 0.00 · 26mssafe · 0.00 · 18msflag · 0.70 · 26ms
claude-opus-4-6safe · 0.01safe · 0.12safe · 0.08
glm-5no image access*safe · 0.15flag · 0.75
doubao-seed-2.0-prosafe · 0.00safe · 0.15safe · 0.10

<sub>*On the office photo glm-5 returned "safe" but its own reason admitted it could not read the image, so I count that cell as a failed call, not a valid result. In production that silent fail-open is the dangerous case.</sub>

NSFW score by model for three safe images: NudeNet and glm-5 over-flag the statue, claude and doubao pass it

The dividing line isn't "dedicated versus LLM." It's context understanding. Here is what each returned for the statue, the image that split them:

NudeNet:  BELLY_EXPOSED 0.70, FEMALE_GENITALIA_COVERED 0.41, ARMPITS_EXPOSED 0.36  -> flag
glm-5:    {"verdict":"flag","nsfw_score":0.75,"categories":{"nudity":1},"reason":"Artistic nude depiction requires human review."}
claude:   {"verdict":"safe","nsfw_score":0.08,"categories":{"nudity":0.3},"reason":"Classical Venus sculpture in a museum. Fine art, not sexual."}

NudeNet is fast (18–26ms) and free to self-host, but it flagged the statue at 0.70 because it detects body parts, not meaning; glm-5 did the same at 0.75. claude-opus-4-6 still set nudity: 0.3 — it saw the nudity — but overruled the verdict on context, the capability a pixel-level detector doesn't have. The failure to watch for is glm-5's: it returned "safe" for the office photo while admitting it couldn't read the image, a silent fail-open you would never catch in production.

Three honest caveats. Latency for the LLMs ran 4–14 seconds per image, versus NudeNet's ~20ms. Each image consumed roughly 730–1,900 input tokens, which on a frontier model works out to about 10–30× the ~$0.001 you'd pay Rekognition, so it belongs off the hot path. And LLM output isn't standardized: you parse prose into a score, and quality swings hard between models. This was a small, informal test on three images, not a benchmark. But it's enough to show the real trade: context understanding versus cost, speed, and consistency.

Dedicated API or LLM vision? A build-vs-buy call

When a dedicated tool wins

High volume, a tight per-image budget, sub-second latency, video, or compliance certifications (SOC 2, a signed GDPR DPA). If you moderate millions of uploads, $1 per 1,000 at 100ms is hard to beat on cost and speed, and LLM vision isn't in the same league there.

When LLM vision earns its cost

Context-sensitive categories where false positives hurt (art, education, medical, breastfeeding), plus cases where you want a human-readable reason for an appeal, need a custom or novel category, or already run a vision model for other features. It's the smart, expensive reviewer, not the bulk filter.

The tiered setup most teams should use

Run a cheap detector (or a self-hosted model like NudeNet) on every upload. As an illustrative starting point only, calibrate before trusting it: auto-block above ~0.85, pass below ~0.3, and route the middle band to an LLM-vision call that reasons about context before a human ever sees it, then tune those cut-offs against a labeled sample of your own traffic. And treat a failed classification as unsafe, not safe: if a response doesn't confirm it read the image or doesn't parse as valid JSON, retry or send it to human review rather than let it pass, exactly the glm-5 fail-open above. You pay dedicated-API rates on the bulk of uploads and reserve LLM cost for the ambiguous cases that actually cause disputes, the art-and-nudity edge where the cheap detector over-flagged the museum statue.

That LLM layer needs access to one or more vision models. A relay such as AIReiter reaches GPT, Claude, and GLM vision through a single OpenAI-compatible endpoint, so the review tier can switch models without separate SDKs or accounts; that's how I ran the four-way test above.

The one thing you should never build yourself: CSAM

One hard line. None of the above applies to child sexual abuse material. Do not train, run, or "test" your own CSAM detector, and don't route suspected CSAM through a general NSFW detection API as if it were ordinary adult content. The established path is hash-matching against known databases (Microsoft's PhotoDNA and the NCMEC and IWF hash lists) plus reporting to NCMEC. Exact reporting duties vary by jurisdiction and by your role as a provider, so treat this as a legal and law-enforcement matter with its own dedicated system, not a classifier you tune.

FAQ

Is there a free NSFW detection API?

Yes. OpenAI's Moderation endpoint (omni-moderation-latest) is free and accepts images. AWS Rekognition and Google Cloud Vision each include about 1,000 free images per month. For unlimited free use, self-host an open-source model like NudeNet, which ran in about 20ms per image in my test.

What's the best NSFW detection API for images and video?

For video, Sightengine and Hive both sample frames and are built for it, and AWS Rekognition offers video moderation too. For images on a budget, AWS Rekognition at $1 per 1,000 is the common default. Weight your choice by cost, category depth, or false-positive rate; there's no single winner.

Can I run NSFW detection in Python without a paid API?

Yes. NudeNet and the Falconsai/nsfw_image_detection model both run locally in Python (pip install nudenet), and the open-source safe-content-ai project packages the latter as a Docker FastAPI service. You trade per-call fees for hosting and maintaining the model yourself.

How accurate are NSFW detection APIs?

Vendors cite 95–98% on their own benchmarks for explicit content. The number that actually bites is the false-positive rate on borderline-safe content (art, swimwear, medical imagery), where, as the test above showed, a fast dedicated detector and a weaker model both over-flagged a museum statue while context-aware LLM vision passed it.

Can I use GPT-4o or Claude vision for content moderation?

Yes, and for context-sensitive cases they avoid false positives better; in my test Claude vision passed a nude statue as fine art while a pixel-level detector flagged it. The cost is speed (seconds, not milliseconds) and price (roughly 10–30× a dedicated API per image), so use them as a review layer rather than the front-line bulk filter.

Related reading