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

api-guardrails

v1.0.0

Published

AI API Terms of Service compliance checker — know what's allowed before you build.

Readme

api-guardrails

npm version License: MIT Zero Dependencies

AI API Terms of Service compliance checker — know what's allowed before you build.

Check if your AI API usage complies with provider Terms of Service. Pure JavaScript, zero dependencies, works in Node.js and the browser.

Website | GitHub

Install

npm install api-guardrails

Quick Start

import { analyzeCompliance, groupByProvider, overallSummary } from 'api-guardrails';

// Describe your use case in plain English
const findings = analyzeCompliance('I want to accept user API keys to proxy OpenAI requests');

// Get overall verdict
const summary = overallSummary(findings);
console.log(summary.verdict);  // 'prohibited'
console.log(summary.message);  // 'This usage pattern likely violates terms for 8 providers.'

// Group by provider for detailed view
const grouped = groupByProvider(findings);
for (const [provider, results] of Object.entries(grouped)) {
  console.log(`${provider}: ${results[0].verdict} — ${results[0].reason}`);
}

API

analyzeCompliance(description: string): Finding[]

Analyzes a plain-English description against all compliance rules.

  • Matches keywords against 16 rule categories
  • Detects mentioned providers (e.g. "OpenAI", "Claude", "GPT-4") and filters results
  • If no providers are mentioned, returns results for all 8 providers

Returns an array of findings:

{
  ruleId: 'byok',           // Rule category ID
  provider: 'openai',       // Provider key
  verdict: 'prohibited',    // 'allowed' or 'prohibited'
  reason: '...',            // Human-readable explanation
  tosSection: 'Section 2(c)' // Relevant ToS section
}

groupByProvider(findings: Finding[]): Record<string, Finding[]>

Groups findings by provider key for display.

worstVerdict(providerFindings: Finding[]): string

Returns 'prohibited' if any finding is prohibited, otherwise 'allowed'.

overallSummary(findings: Finding[]): Summary

Returns an overall verdict with a human-readable message:

{
  verdict: 'prohibited' | 'allowed' | 'unknown',
  message: '...'
}

providers: Record<string, Provider>

The full provider data object with ToS URLs, allowed/prohibited lists, and key ToS points.

getProvider(slug: string): Provider | null

Get a single provider by slug (e.g. 'openai', 'anthropic').

getAllProviders(): Provider[]

Get all providers as an array.

getAllProviderSlugs(): string[]

Get all provider slug strings.

Rule Categories

The engine checks against 16 use-case patterns:

| ID | Category | Common Verdict | |----|----------|----------------| | byok | BYOK / key proxying | Prohibited (all) | | resell | Reselling / sublicensing | Prohibited (all) | | saas-own-key | SaaS with own key | Allowed (all) | | free-commercial | Free tier for production | Mixed | | train-competing | Training competing models | Mixed | | high-stakes | Medical/legal/financial automation | Prohibited (all) | | harmful-content | Weapons, malware, CSAM | Prohibited (all) | | circumvent | Bypassing limits/safety | Prohibited (all) | | chatbot | Chatbots and assistants | Allowed (all) | | rag | RAG and embeddings | Allowed (all) | | code-gen | Code generation | Allowed (all) | | content-writing | Blog posts, marketing | Allowed (all) | | image-gen | Image generation | Allowed (all) | | data-analysis | Summarization and analysis | Allowed (all) | | translation | Translation and i18n | Allowed (all) | | surveillance | Mass surveillance | Prohibited (all) | | education | Tutoring and e-learning | Allowed (all) |

Providers

| Provider | Slug | ToS Last Verified | |----------|------|-------------------| | OpenAI | openai | 2025-12-09 | | Anthropic | anthropic | 2025-10-16 | | Google (Gemini) | google | 2025-06-12 | | Groq | groq | 2025-03-15 | | Cerebras | cerebras | 2025-01-20 | | SambaNova | sambanova | 2025-02-01 | | Mistral | mistral | 2025-04-01 | | Cohere | cohere | 2025-03-01 |

Disclaimer

This package provides informational guidance based on publicly available Terms of Service documents. It is not legal advice. Terms of Service change frequently — always verify with the provider's current documentation before making business decisions.

License

MIT