# How moderation works

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

> For AI agents: the complete documentation index is at https://nosmai.com/llms/moderations.txt

Product: Nosmai Moderation
Group: core-concepts
Source: https://nosmai.com/docs/moderations/concepts/

## The four surfaces

One license key unlocks four ways to moderate:

| Surface | What it does | Method |
| --- | --- | --- |
| Image | Moderate a single photo | `analyzeImage` |
| Video | Sample and aggregate a recorded clip | `analyzeVideo` |
| Text | Moderate a chat message or comment | `moderateText` |
| Live camera | Real-time per-frame moderation | `startStream` and frames |

## What it detects

**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:

| Field | Type | Description |
| --- | --- | --- |
| `isUnsafe` | bool | True if NSFW is `block` |
| `nsfw` | enum | `safe`, `warn` or `block` |
| `nsfwScores` | object | `safe`, `sexy`, `explicit` (0 to 1) |

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

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

## Thresholds

Both NSFW bars are adjustable at runtime. Lower is stricter. The defaults are tuned to balance catching unsafe content against false positives.

```text
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 NSFW check 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.
