Before you start
You need a Nosmai license key for your app. It looks like NOSMAI-XXXX and is tied to your app's package name or bundle identifier and to the platform. Get one from the Nosmai dashboard.
The first launch verifies the key online, so make sure the device has connectivity the first time you run your app.
1. Install
Pick your platform.
Flutter
dependencies: nosmai_moderation_sdk: ^2.0.0
iOS
pod 'NosmaiModerationSDK', '~> 2.0.1'
React Native
npm install @nosmai/[email protected]
Android (download nosmai-detection.aar from the releases page, put it in app/libs/, then reference it):
dependencies {
implementation(files("libs/nosmai-detection.aar"))
}
2. Initialize
Initialize once at startup with your license key. Initialization does a network check and loads the models, so run it off the main thread.
Flutter
final res = await NosmaiModeration.initialize('NOSMAI-XXXX');
if (!res.success) debugPrint('init failed: ${res.error}');
iOS
DispatchQueue.global(qos: .userInitiated).async {
let ok = NosmaiSDK.initialize(licenseKey: "NOSMAI-XXXX")
}
Android
Executors.newSingleThreadExecutor().execute {
val ok = NosmaiSDK.init(context, "NOSMAI-XXXX")
}
React Native
import { NosmaiModeration } from '@nosmai/moderation-react-native';
const res = await NosmaiModeration.initialize('NOSMAI-XXXX', ['nsfw']);
if (!res.success) console.warn('init failed:', res.error);
3. Run your first check
Moderate an image and read the verdict.
Flutter
final r = await NosmaiModeration.analyzeImage(file.path); print(r.isUnsafe ? 'UNSAFE' : 'SAFE');
iOS
if let r = NosmaiSDK.analyzeImage(uiImage) {
print(r.isUnsafe ? "UNSAFE" : "SAFE")
}
Android
val r = NosmaiSDK.analyzeImage(bitmap)
Log.d("Mod", if (r.isUnsafe) "UNSAFE" else "SAFE")
React Native
const r = await NosmaiModeration.analyzeImage(filePath); console.log(r.isUnsafe ? 'UNSAFE' : 'SAFE');
Next steps
- How moderation works: surfaces, detection types, results and thresholds.
- Platform guides: iOS, Android, Flutter, React Native.
- Authentication: how license keys and offline validation work.