JavaScript SDK

Learn about our JavaScript SDK

To use our SDK you firstly need to install it through NPM:

npm install nsey-sdk

Importing the SDK

// If your project uses ES Modules:
import { detect } from 'nsey-sdk';

// If your project uses CommonJS:
const { detect } = require('nsey-sdk');

Basic Usage

async function nsey_detect(text, model = 'nsey') {
  try {
    const result = await detect(text, model);
    console.log('Detection result:', result);
  } catch (error) {
    console.error('Error detecting text:', error);
  }
}

// Example usage
nsey_detect('Hello World');

Example: Handling NSFW Content

async function check_message(message) {
  const result = await detect(message);
  if (result.nsfw) {
    console.log('NSFW content detected!');
  } else {
    console.log('Content is safe.');
  }
}

check_message('Some text to check');

Notes

  • text – The text you want to analyze.

  • model – Optional. Specifies which detection model to use, or auto.

  • The result object contains the detection outcome and confidence scores. Check result.nsfw or result.SAFE/result.NSFW depending on your needs.

  • Always handle errors when calling detect to avoid crashes from network issues or invalid input.

Last updated