Moderation Web
Moderation / Platform guides / Web
Updated July 6, 2026

On-device content moderation for the web: check images, text and the live camera or screen share right in the browser, with no cloud round-trip.

Install

npm install @nosmai/moderation-web

Host the models. The model files come with your license. Serve them as static files your site can fetch, for example under /models/: nsm_nsfw.onnx, nsm_detector.onnx, nsm_text.onnx and vocab.txt. They ship encrypted and are decrypted in the browser only after a valid license check.

Requirements: a modern browser (the SDK runs on ONNX Runtime Web, WASM by default with WebGPU optional) and a bundler (React, Vue, vanilla JS, and so on). The license key is bound to your site's domain.

Initialize

Validate the license once, then load the models you use. Each model is a separate file you host.

import { NosmaiModeration } from '@nosmai/moderation-web';

const res = await NosmaiModeration.initialize('NOSMAI-XXXX');
if (!res.success) console.error('license:', res.status, res.error);

await NosmaiModeration.initializeNsfw({ modelUrl: '/models/nsm_nsfw.onnx' });
await NosmaiModeration.initializeDetector({ modelUrl: '/models/nsm_detector.onnx' });
await NosmaiModeration.initializeText({
  modelUrl: '/models/nsm_text.onnx',
  vocabUrl: '/models/vocab.txt',
});

Optionally prefer the GPU before loading models:

NosmaiModeration.setExecutionProviders(['webgpu', 'wasm']);

Moderate an image

Pass any image source the browser can draw: an HTMLImageElement, a canvas, or an ImageBitmap.

const r = await NosmaiModeration.analyzeImage(imageElement);   // objects + NSFW
if (r.isUnsafe) {
  // r.detections, r.nsfw -> 'safe' | 'warn' | 'block'
}

Moderate text

const t = await NosmaiModeration.moderateText('some message');
if (t.blocked) {
  // t.layer ('blocklist' | 'classifier'), t.category
}

Live camera or screen

Play the stream in a <video> element and receive a result per analyzed frame. Use source: 'screen' for screen-share moderation.

await NosmaiModeration.startLive({
  video: videoEl,
  source: 'camera',            // or 'screen'
  onResult: (r) => {
    // r.isUnsafe, r.nsfw, r.detections
  },
});

// on leave
NosmaiModeration.stopLive();

Cleanup

NosmaiModeration.shutdown();

[!NOTE] On the web there is no separate recorded-video call: to moderate a clip, draw frames from a <video> onto a canvas and pass each to analyzeImage. Decision thresholds are fixed by the model's calibration.

Nosmai

An AR and AI company. Founded on the idea that the next decade of software will be visual, and that the tools for it should be within reach of anyone building.

Newsletter

Product updates and release notes. No spam.

© 2026 nosmai, inc · all rights reserved