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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nextauralabs/vettly-sdk

v0.1.13

Published

Protect your users from harmful content. TypeScript SDK for Vettly.

Readme

@nextauralabs/vettly-sdk

Content moderation that just works. One API for text, images, and video.

Installation

npm install @nextauralabs/vettly-sdk

Quick Start

import { createClient } from '@nextauralabs/vettly-sdk'

const client = createClient('sk_live_...')

const result = await client.check({
  content: 'User-generated text',
  policyId: 'community-safe'
})

if (result.action === 'block') {
  // Content blocked
}

Get Your API Key

  1. Sign up at vettly.dev
  2. Go to Dashboard → API Keys
  3. Create and copy your key

Features

  • Text, images, video - One unified API for all content types
  • Custom policies - Define thresholds in YAML
  • Webhooks - Get notified when content is flagged
  • Dashboard - Monitor decisions and export logs
  • Automatic retries - Exponential backoff for rate limits and server errors
  • TypeScript - Full type safety with typed errors

Text Moderation

const result = await client.check({
  content: 'User-generated text',
  policyId: 'community-safe',
  contentType: 'text'
})

console.log(result.action)     // 'allow' | 'warn' | 'flag' | 'block'
console.log(result.categories) // Array of { category, score, triggered }
console.log(result.decisionId) // UUID for audit trail

Image Moderation

// From URL
const result = await client.checkImage(
  'https://example.com/image.jpg',
  { policyId: 'strict' }
)

// From base64
const result = await client.checkImage(
  'data:image/jpeg;base64,/9j/4AAQ...',
  { policyId: 'strict' }
)

Idempotency

Prevent duplicate processing with request IDs:

const result = await client.check(
  { content: 'Hello', policyId: 'default' },
  { requestId: 'unique-request-id-123' }
)

Error Handling

The SDK provides typed errors for better error handling:

import {
  VettlyAuthError,
  VettlyRateLimitError,
  VettlyQuotaError,
  VettlyValidationError
} from '@nextauralabs/vettly-sdk'

try {
  await client.check({ content: 'test', policyId: 'default' })
} catch (error) {
  if (error instanceof VettlyAuthError) {
    console.log('Invalid API key')
  } else if (error instanceof VettlyRateLimitError) {
    console.log(`Rate limited. Retry after ${error.retryAfter}s`)
  } else if (error instanceof VettlyQuotaError) {
    console.log(`Quota exceeded: ${error.quota?.used}/${error.quota?.limit}`)
  }
}

Webhook Signature Verification

Verify webhook signatures to ensure authenticity:

import { verifyWebhookSignature, constructWebhookEvent } from '@nextauralabs/vettly-sdk'

app.post('/webhooks/vettly', async (req, res) => {
  const signature = req.headers['x-vettly-signature']
  const payload = req.rawBody // Make sure to get raw body as string

  const isValid = await verifyWebhookSignature(payload, signature, webhookSecret)

  if (!isValid) {
    return res.status(401).send('Invalid signature')
  }

  const event = constructWebhookEvent(payload)

  if (event.type === 'decision.blocked') {
    // Handle blocked content
  }

  res.status(200).send('OK')
})

Configuration

import { ModerationClient } from '@nextauralabs/vettly-sdk'

const client = new ModerationClient({
  apiKey: 'sk_live_...',
  apiUrl: 'https://api.vettly.dev', // Optional: custom API URL
  timeout: 30000,                    // Optional: request timeout in ms (default: 30000)
  maxRetries: 3,                     // Optional: max retries for failures (default: 3)
  retryDelay: 1000,                  // Optional: base delay for backoff in ms (default: 1000)
})

Express Middleware

import { createClient, moderateContent } from '@nextauralabs/vettly-sdk'

const client = createClient('sk_live_...')

app.post('/comments',
  moderateContent({
    client,
    policyId: 'community-safe',
    field: 'body.comment' // Optional: path to content field
  }),
  (req, res) => {
    // Content is safe, proceed with your logic
  }
)

Response Format

{
  "decisionId": "550e8400-e29b-41d4-a716-446655440000",
  "action": "block",
  "safe": false,
  "flagged": true,
  "categories": [
    { "category": "hate_speech", "score": 0.91, "triggered": true },
    { "category": "harassment", "score": 0.08, "triggered": false }
  ],
  "provider": "hive",
  "latency": 147,
  "cost": 0.001
}

Pricing

| Plan | Price | Text | Images | Videos | |------|-------|------|--------|--------| | Developer | Free | 10,000/mo | 250/mo | 100/mo | | Starter | $29/mo | Unlimited | 5,000/mo | 2,000/mo | | Pro | $79/mo | Unlimited | 20,000/mo | 10,000/mo | | Enterprise | $499/mo | Unlimited | 200,000/mo | 100,000/mo |

Links