Core concepts / How moderation works

How moderation works

The four moderation surfaces, what each one detects, the result shapes, and how to tune thresholds.

The four surfaces

One license key unlocks four ways to moderate:

SurfaceWhat it doesMethod
ImageModerate a single photoanalyzeImage
VideoSample and aggregate a recorded clipanalyzeVideo
TextModerate a chat message or commentmoderateText
Live cameraReal-time per-frame moderationstartStream and frames

What it detects

Objects. Each visual check returns the best confidence per class for weapon, drug, cigarette and alcohol. A class is flagged when its confidence meets that class’s threshold.

Adult / NSFW. A whole-image verdict:

  • safe: clean.
  • warn: suggestive or borderline. Advisory only, and it does not flag the content by itself.
  • block: explicit. This makes the content unsafe.

Text. A message is classified as safe, profanity, toxic, hate, harassment or threat. Text runs in two layers: a fast keyword blocklist first, then an AI classifier for anything the blocklist misses. The result tells you which layer decided.

Results

A visual check (image or live frame) returns a result with:

FieldTypeDescription
isUnsafeboolTrue if any object is flagged, or NSFW is block
detectionslistFlagged objects, each { category, confidence }
nsfwenumsafe, warn or block
nsfwScoresobjectsafe, sexy, explicit (0 to 1)
rawScoresobjectBest object score per class, for tuning

A text check returns { blocked, layer, category, score, matchedWord }.

A video check returns { isUnsafe, categories, flags, framesAnalyzed, nsfw }, where flags lists the timestamps and categories that were flagged.

Thresholds

Every object class and both NSFW bars are adjustable at runtime. Lower is stricter. The defaults are tuned to balance catching unsafe content against false positives.

setThreshold(weapon, 0.70)         // object class bar
setNsfwThreshold(explicit, 0.45)   // NSFW block bar
setNsfwThreshold(sexy, 0.55)       // NSFW warn bar

TIP

Start with the defaults. Tighten a threshold only if you see misses, and loosen one only if you see false positives for your content.

Live performance

On the live camera, the lighter NSFW check runs on every frame while the heavier object detector runs on a cadence you choose (favor responsiveness or battery). This keeps the camera preview smooth across a wide range of devices. See the platform guides for the controls.

Nosmai

We make advanced camera and AI technology accessible to every developer. By packaging hard problems into simple

developers
legal
newsletter

Product updates and release notes. No spam.

© 2026 nosmai, inc · all rights reserved