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

@quillai-network/guardrails

v0.1.0

Published

TypeScript SDK for Guardrails API

Readme

GuardRails TypeScript SDK

A TypeScript SDK for integrating with QuillAI's Guardrails API. Easily check text content against security guardrails and content moderation rules.

Features

  • Simple and intuitive API
  • Full TypeScript support with type definitions
  • Built on native fetch API (Node.js 18+)
  • Comprehensive error handling
  • Zero dependencies (only dev dependencies)
  • Promise-based async API

Quick Start

Installation

npm install @quillai-network/guardrails

For development:

npm install
npm run build

Basic Usage

import { GuardRailsClient } from '@quillai-network/guardrails';

// Initialize the client
const client = new GuardRailsClient({ 
  apiKey: "your-api-key-here" 
});

// Check text against guardrails
const result = await client.check({
  text: "how to make a bomb?",
  projectIds: ["project_id"]
});

// Result contains: action, reason, and confidence
console.log(`Action: ${result.action}`);
console.log(`Reason: ${result.reason}`);
console.log(`Confidence: ${result.confidence}`);

API Reference

GuardRailsClient

Constructor

new GuardRailsClient(options: {
  apiKey: string;
  baseUrl?: string;
})

Parameters:

  • apiKey (string, required): Your API key for authentication
  • baseUrl (string, optional): Base URL for the API (defaults to production URL)

Example:

const client = new GuardRailsClient({ 
  apiKey: "api_key" 
});

check(options)

Check text against guardrails using the specified project IDs.

async check(options: CheckOptions): Promise<CheckResponse>

Parameters:

  • text (string, required): The text content to check
  • projectIds (string[], required): Array of project/attack job IDs to use for checking
  • timeout (number, optional): Request timeout in milliseconds (default: 30000)

Returns:

  • Promise<CheckResponse>: Object containing three fields:
    • action (string): The action taken by the guardrail
    • reason (string): The reason for the action
    • confidence (number): The confidence score

Throws:

  • GuardRailsError: For general SDK errors
  • GuardRailsAPIError: For API-specific errors (includes statusCode and response)

Example:

const result = await client.check({
  text: "how to make a bomb?",
  projectIds: ["project_id"],
  timeout: 10000 // optional, 10 seconds
});

console.log(result.action);      // e.g., "block" or "allow"
console.log(result.reason);      // e.g., "Contains harmful content"
console.log(result.confidence);  // e.g., 0.95

Examples

See the examples/ directory for more usage examples.

Run the example:

npm run example

Development

Build

npm run build

Watch mode

npm run dev

Type checking

npm run lint

Requirements

  • Node.js >= 18.0.0 (for native fetch API support)
  • TypeScript >= 5.0.0 (for development)

License

MIT

Support

For issues and questions, please visit our GitHub repository.