Package Exports
- zerolabel
- zerolabel/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zerolabel) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
✨ What if you could classify anything without training models?
import { classify } from 'zerolabel';
const results = await classify({
texts: ['I love this product!'],
labels: ['positive', 'negative', 'neutral'],
apiKey: process.env.INFERENCE_API_KEY
});
// Done. No training, no datasets, no complexity.That's it. Text, images, or both. 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 anything, instantly
const results = await classify({
texts: ['I love this product!'],
labels: ['positive', 'negative', 'neutral'],
apiKey: process.env.INFERENCE_API_KEY
});
console.log(results[0].predicted_label); // 'positive'That's it. No training, no infrastructure, no complexity.
⚡ Installation
npm install zerolabel🚀 Examples
Text Classification
await classify({
texts: ['Amazing product!', 'Worst purchase ever', 'It\'s okay'],
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
});🎯 Real-World Use Cases
| Use Case | Labels | Input |
|---|---|---|
| Email Triage | ['urgent', 'normal', 'spam'] |
Email content |
| Content Moderation | ['safe', 'nsfw', 'spam'] |
User posts + images |
| Support Tickets | ['bug', 'feature', 'question'] |
Ticket descriptions |
| Document Classification | ['invoice', 'receipt', 'contract'] |
Document images |
| Sentiment Analysis | ['positive', 'negative', 'neutral'] |
Reviews/feedback |
🏗️ How It Works
- You provide: Text/images and your custom labels
- We handle: The AI model (Google Gemma 3-27B), prompting, and inference
- You get: Instant predictions with confidence scores
Powered by inference.net infrastructure
📊 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
- Sign up at inference.net
- Get your API key from the dashboard
- Set it as
INFERENCE_API_KEYenvironment 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 |
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 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!