Skip to main content

Node SDK

npm install @chidakashi-ai/safety

Node 18 or newer, ESM and CommonJS, with TypeScript types.

import { Policies, SafetyClient, isSafe } from '@chidakashi-ai/safety';

const creds = { apiKey: process.env.SAFETY_API_KEY! };

await new Policies(creds).save('chat', 'No threats of violence.');

const client = new SafetyClient(creds);
const result = await client.checkText(message, 'chat');
if (!isSafe(result)) await reject();
ExportWhat it does
PoliciesSave, get, list and remove policy sets.
SafetyClientcheckText and checkImage.
isSafetrue only for a pass verdict.

Every function and option is in the SDK reference.