npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cleanmod/js

v0.2.0

Published

Official JavaScript/TypeScript client for the CleanMod moderation API

Downloads

64

Readme

@cleanmod/js

Official JavaScript/TypeScript client for the CleanMod moderation API.

Installation

npm install @cleanmod/js

# or

yarn add @cleanmod/js

# or

pnpm add @cleanmod/js

Usage

import { createCleanModClient } from "@cleanmod/js";

const client = createCleanModClient({
  apiKey: process.env.CLEANMOD_API_KEY!,
});

async function run() {
  const result = await client.moderate({
    text: "you are an idiot",
    mode: "strict", // optional: "lenient", "default", or "strict"
  });

  console.log(result.decision, result.overallScore, result.categories);
  console.log(result.mode, result.thresholds); // mode and thresholds used
}

run().catch(console.error);

By default, the client targets https://cleanmod.dev. You can override via baseUrl if needed:

const client = createCleanModClient({
  apiKey: process.env.CLEANMOD_API_KEY!,
  baseUrl: "https://custom.cleanmod.dev",
  timeoutMs: 5000, // optional, default is 10000ms
});

API Reference

createCleanModClient(options: CleanModOptions): CleanModClient

Creates a new CleanMod client instance.

Options:

  • apiKey (required): Your CleanMod API key
  • baseUrl (optional): Base URL for the API (default: https://cleanmod.dev)
  • timeoutMs (optional): Request timeout in milliseconds (default: 10000)

client.moderate(request: ModerateRequest): Promise<ModerateResponse>

Moderates a text input.

Request:

  • text (required): The text to moderate

  • model (optional): The moderation model to use (default: "english-basic")

  • mode (optional): The moderation sensitivity mode. Must be one of:

    • "lenient": Higher thresholds (flag: 0.9, block: 0.98) - Only very toxic content is flagged
    • "default": Balanced thresholds (flag: 0.8, block: 0.95) - Standard moderation
    • "strict": Lower thresholds (flag: 0.3, block: 0.6) - More aggressive flagging

    If not provided, uses your organization's default mode (set in dashboard), or falls back to "default".

Response:

  • id: Unique identifier for the moderation request
  • model: The model used for moderation
  • provider: The moderation provider (e.g., "unitary")
  • providerModel: The specific provider model used
  • decision: The moderation decision ("allow", "flag", or "block")
  • overallScore: Overall toxicity score (0-1)
  • thresholds: Object containing flag and block threshold values used for decision making
  • categories: Object mapping category names to scores (0-1)
  • mode: The moderation mode that was used for this request (either from the request or your organization's default)
  • createdAt: ISO 8601 timestamp of when the moderation was performed

License

MIT