Nosmai Effects Nosmai Moderation Nosmai Try-ons coming soon
docs / nosmai moderation / reference / api reference

API Reference

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

MethodWhat it doesReturns
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 cameraStream 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)

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

Text result

FieldTypeDescription
blockedboolTrue if the message should be blocked
layerenumWhich layer decided: none, blocklist or classifier
categoryenumsafe, profanity, toxic, hate, harassment or threat
scorenumber1.0 for a blocklist hit, the model probability otherwise
matchedWordstringThe banned word that matched (blocklist hits only)

Video result

FieldTypeDescription
isUnsafeboolTrue if any object was flagged, or any frame was NSFW block
categorieslistDistinct object categories flagged across the clip
flagslistPer flagged frame: { timestampMs, category, confidence }
framesAnalyzednumberHow many frames were sampled
nsfwenumWorst NSFW verdict across the clip

Enums

EnumValues
Object categoryweapon, drug, cigarette, alcohol
NSFW verdictsafe, warn, block
NSFW class (for setNsfwThreshold)explicit (block bar), sexy (warn bar)
Text categorysafe, profanity, toxic, hate, harassment, threat
Text layernone, 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.

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