JavaScript / TypeScript SDK

JavaScript / TypeScript SDK

Official TypeScript client for Node, Bun, Deno, and the browser. Zero dependencies (native fetch).

Install

npm install github:Phosphor-gg/supervisor-sdk-js

The package builds on install, so it works with npm, pnpm, and yarn straight from GitHub.

Ships with full type definitions. Grab an API key from your dashboard under API Keys.

Moderate text

import { SupervisorClient } from "supervisor-sdk";

const client = new SupervisorClient({ apiKey: "sk_prod_..." });

const result = await client.moderate({ text: "text to check" });
console.log(result.flagged, result.labels);

Methods

// Single text or image (base64)
await client.moderate({ text, image, model, enabled_labels, include_context });

// Many at once -> ModerationResponse[]
await client.moderateBatch({ texts, images, model });

// A short video: bytes, a Blob, or base64 -> VideoModerationResponse
await client.moderateVideo(videoBytes, { model, enabled_labels });

// Username policy check -> { flagged, score }
await client.checkUsername("user123");

// All labels -> Record<string, string>
await client.getLabels();

All methods return Promises. model is "auto" | "observer" | "sentinel" | "arbiter".

A VideoModerationResponse has flagged, labels (the union across frames), frames (each with timestamp_ms, flagged and labels), frames_analysed, duration_secs, codec and decoder. The 10 MB size limit is checked locally, so an oversized clip rejects before it is uploaded.

Platform API

Moderate on behalf of your own users with a registered platform's client_id / client_secret (created in the dashboard under Platform API).

import { PlatformClient } from "supervisor-sdk";

const platform = new PlatformClient({ clientId: "...", clientSecret: "sk_platform_..." });

await platform.provisionUser("user@example.com");
const result = await platform.moderate({ user_email: "user@example.com", text: "text to check" });

Other methods: listUsers(), getUser(id), createCheckout(...), getConnectStatus(). See the Platform API guide.