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();
| Export | What it does |
|---|---|
Policies | Save, get, list and remove policy sets. |
SafetyClient | checkText and checkImage. |
isSafe | true only for a pass verdict. |
Every function and option is in the SDK reference.