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

zerolabel

v1.0.18

Published

Zero-shot multimodal classification SDK - classify text and images with custom labels, no training required

Downloads

32

Readme

npm version TypeScript


✨ What if you could classify anything without training models?

import { classify } from 'zerolabel';

// Classify single or multiple texts at once
const results = await classify({
  texts: [
    'I love this product!',
    'This is terrible quality',
    'Not bad, could be better'
  ],
  labels: ['positive', 'negative', 'neutral'],
  apiKey: process.env.INFERENCE_API_KEY
});

// Get results for each text
results.forEach((result, i) => {
  console.log(`Text ${i + 1}: ${result.predicted_label} (${result.confidence}%)`);
});

That's it. Text, images, or both. Single items or batches. Any labels you want. Results in milliseconds.


🤔 The Problem

Building classification usually means:

  • ❌ Collecting thousands of labeled examples
  • ❌ Training models for hours/days
  • ❌ Managing ML infrastructure
  • ❌ Retraining when you need new categories

zerolabel solves this in one line of code.


🤔 The Solution

import { classify } from 'zerolabel';

// Classify single or multiple texts at once
const results = await classify({
  texts: [
    'I love this product!',
    'This is terrible quality',
    'Not bad, could be better'
  ],
  labels: ['positive', 'negative', 'neutral'],
  apiKey: process.env.INFERENCE_API_KEY
});

// Get results for each text
results.forEach((result, i) => {
  console.log(`Text ${i + 1}: ${result.predicted_label} (${result.confidence}%)`);
});

That's it. No training, no infrastructure, no complexity.


⚡ Installation

npm install zerolabel

🚀 Examples

Text Classification (Single or Batch)

// Process multiple texts efficiently
await classify({
  texts: [
    'Amazing product!', 
    'Worst purchase ever', 
    'It\'s okay', 
    'Best value for money',
    'Would not recommend'
  ],
  labels: ['positive', 'negative', 'neutral'],
  apiKey: process.env.INFERENCE_API_KEY
});

// Or just one text
await classify({
  texts: ['Single text to classify'],
  labels: ['positive', 'negative', 'neutral'],
  apiKey: process.env.INFERENCE_API_KEY
});

Image Classification

await classify({
  images: ['data:image/jpeg;base64,...'],
  labels: ['cat', 'dog', 'bird'],
  apiKey: process.env.INFERENCE_API_KEY
});

Both Together (Multimodal)

await classify({
  texts: ['Check out this cute animal!'],
  images: ['data:image/jpeg;base64,...'],
  labels: ['cute cat', 'cute dog', 'not cute'],
  apiKey: process.env.INFERENCE_API_KEY
});

Custom Categories

await classify({
  texts: ['Fix login bug', 'Add dark mode', 'Server is down!'],
  labels: ['bug_report', 'feature_request', 'incident'],
  apiKey: process.env.INFERENCE_API_KEY
});

Batch Processing Made Easy

Process thousands of texts efficiently in a single API call:

import { classify } from 'zerolabel';

// Classify entire datasets at once
const reviews = [
  "Amazing product, highly recommend!",
  "Terrible quality, waste of money",
  "It's okay, nothing special",
  "Best purchase I've made this year",
  "Would not buy again",
  // ... thousands more
];

const results = await classify({
  texts: reviews,
  labels: ['positive', 'negative', 'neutral'],
  apiKey: process.env.INFERENCE_API_KEY
});

// Process results
results.forEach((result, index) => {
  console.log(`Review ${index + 1}: ${result.predicted_label} (${result.confidence}%)`);
});

// Or analyze by label distribution
const distribution = results.reduce((acc, result) => {
  acc[result.predicted_label] = (acc[result.predicted_label] || 0) + 1;
  return acc;
}, {});

console.log('Sentiment distribution:', distribution);

Benefits of batch processing:

  • Faster: Single API call vs. hundreds of individual requests
  • Cost-effective: Reduced API overhead and latency
  • Simple: Same API, just pass an array
  • Scalable: Handle datasets of any size

🎯 Real-World Use Cases

| Use Case | Labels | Input | |----------|--------|-------| | Email Triage | ['urgent', 'normal', 'spam'] | Single email or batch of emails | | Content Moderation | ['safe', 'nsfw', 'spam'] | User posts + images (single or batch) | | Support Tickets | ['bug', 'feature', 'question'] | Ticket descriptions (process entire queue) | | Document Classification | ['invoice', 'receipt', 'contract'] | Document images (single or batch) | | Sentiment Analysis | ['positive', 'negative', 'neutral'] | Reviews/feedback (analyze all at once) |


🏗️ How It Works

  1. You provide: Text/images and your custom labels
  2. We handle: The AI model (Google Gemma 3-27B), prompting, and inference
  3. You get: Instant predictions with confidence scores

📊 Response Format

[
  {
    "text": "I love this product!",
    "predicted_label": "positive", 
    "confidence": 95.2,
    "probabilities": {
      "positive": 0.952,
      "negative": 0.048
    }
  }
]

🔧 Configuration

import { ZeroLabelClient } from 'zerolabel';

const client = new ZeroLabelClient({
  apiKey: process.env.INFERENCE_API_KEY,
  maxRetries: 3
});

const results = await client.classify({
  texts: ['Hello world'],
  labels: ['greeting', 'question']
});

🔑 Getting Your API Key

  1. Sign up at inference.net
  2. Get your API key from the dashboard
  3. Set it as INFERENCE_API_KEY environment variable
export INFERENCE_API_KEY="your-key-here"

💡 Why zerolabel?

| Traditional ML | zerolabel | |----------------|-----------| | Weeks to collect data | ✅ Instant | | Hours to train models | ✅ No training needed | | Complex infrastructure | ✅ One npm install | | Fixed categories | ✅ Any labels you want | | Expensive compute | ✅ Pay per request |


🌟 Live Demo

Try it yourself: zerolabel.dev


📚 API Reference

classify(options)

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | texts | string[] | No* | Array of texts to classify (single or multiple) | | images | string[] | No* | Array of base64 image data URIs |
| labels | string[] | ✅ | Your classification categories | | apiKey | string | ✅ | Your inference.net API key (set as INFERENCE_API_KEY) | | criteria | string | No | Additional classification criteria |

*At least one of texts or images is required


🛠️ TypeScript Support

Full TypeScript definitions included:

import type { 
  ClassificationInput, 
  ClassificationResult,
  ZeroLabelConfig 
} from 'zerolabel';

❓ FAQ

Q: What models does this use?
A: Google Gemma 3-27B, optimized for classification tasks.

Q: How accurate is it?
A: Comparable to fine-tuned models for most classification tasks, especially with descriptive labels.

Q: Can I process multiple texts at once?
A: Yes! Pass an array of texts and get results for each one in a single API call.

Q: Can I use custom models?
A: No, we use inference.net's infrastructure with optimized models for best performance.

Q: Is there a rate limit?
A: Limits depend on your inference.net plan.


🤝 Contributing

Issues and PRs welcome! See our GitHub repo.


📄 License

MIT - Use it however you want!