The complete Nosmai Moderation API: methods, result shapes and enums, shared across every platform.
This reference lists the methods, result shapes and enums the SDK exposes. Method names vary slightly per platform (for example iOS initialize(licenseKey:) vs Android init(context, key)), so the exact signatures live in the platform guides. The result fields and enum values below are the same on every platform.
Methods
| Method | What it does | Returns |
|---|
initialize(licenseKey, [models]) | Validate the license and load the requested models. Call once at startup, off the main thread. | Init result: { success, error } |
initializeText() | Load the text-moderation model. Call after initialize. | bool |
analyzeImage(image) | Moderate a single image (objects + NSFW). | Visual result |
analyzeVideo(path, frameIntervalMs) | Sample a recorded clip every frameIntervalMs and aggregate. Not available on web. | Video result |
moderateText(message) | Moderate a chat message or comment. | Text result |
| Live camera | Stream frames and receive a result per frame. Native / React Native push frames or render a preview view; web calls startLive with a <video> element. | Visual result per frame |
setThreshold(category, value) | Override an object-class confidence bar at runtime. Not adjustable on web. | void |
setNsfwThreshold(class, value) | Override the NSFW block (explicit) or warn (sexy) bar. Not adjustable on web. | void |
setPerformanceMode(mode) | Live only: how often the heavier object detector runs. NSFW always runs every frame. | void |
shutdown() | Release the models and free memory. | void |
Visual result (image and live frame)
| Field | Type | Description |
|---|
isUnsafe | bool | True if any object is flagged, or NSFW is block |
detections | list | Flagged objects, each { category, confidence } |
nsfw | enum | safe, warn or block |
nsfwScores | object | safe, sexy, explicit (0 to 1) |
rawScores | object | Best object score per class, for tuning |
Text result
| Field | Type | Description |
|---|
blocked | bool | True if the message should be blocked |
layer | enum | Which layer decided: none, blocklist or classifier |
category | enum | safe, profanity, toxic, hate, harassment or threat |
score | number | 1.0 for a blocklist hit, the model probability otherwise |
matchedWord | string | The banned word that matched (blocklist hits only) |
Video result
| Field | Type | Description |
|---|
isUnsafe | bool | True if any object was flagged, or any frame was NSFW block |
categories | list | Distinct object categories flagged across the clip |
flags | list | Per flagged frame: { timestampMs, category, confidence } |
framesAnalyzed | number | How many frames were sampled |
nsfw | enum | Worst NSFW verdict across the clip |
Enums
| Enum | Values |
|---|
| Object category | weapon, drug, cigarette, alcohol |
| NSFW verdict | safe, warn, block |
NSFW class (for setNsfwThreshold) | explicit (block bar), sexy (warn bar) |
| Text category | safe, profanity, toxic, hate, harassment, threat |
| Text layer | none, blocklist, classifier |
[!NOTE] On native platforms enums are typed values (for example NosmaiCategory.weapon); on React Native and web they cross as plain strings you can compare directly.