PaxmodGuard
Local guardrail for AI companions, chatbots and kids' game chat. It runs on your own CPU in Node via onnxruntime. There is no API key, and messages never leave your server.
Open npm package @paxmod/guard v0.1.1. Full API surface is on the npm README; this page is the install path and when to use the hosted Paxmod API instead.
Install and quickstart
After the first model download there are no network calls. The model is a 0.3B multilingual encoder. A short message takes a few milliseconds on an ordinary CPU (two threads).
npm install @paxmod/guardimport { createGuard } from "@paxmod/guard";
const guard = await createGuard(); // downloads the model once (about 220 MB) to ~/.cache/paxmod-guard
// 1. Check what the user sent before your model sees it
const input = await guard.checkInput(userMessage);
if (input.crisisReply) return input.crisisReply; // self-harm risk: answer with crisis support, not the persona
if (input.labels.includes("jailbreak")) return "Let's keep things friendly.";
// 2. Check what your bot wrote before the user sees it
const reply = await llm.generate(userMessage);
const output = await guard.checkOutput(reply);
if (output.flagged) return regenerateOrRefuse(output.labels);
return reply;Needs about 1 GB of memory: run it in a container or on a server, not in small serverless functions.
When to use the hosted Paxmod API instead
PaxmodGuard checks the messages and conversations you pass it, on hardware you run. Use the hosted Paxmod API when you want a managed service: the hosted model is trained on real Paxmod data and ranks better on real kids' chat, and you do not need a 1 GB container. Hosted also covers conversation-level risk that builds across days, a console for your safety team, and model updates.