
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Zero-shot multimodal classification SDK - classify text and images with custom labels, no training required
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.
Building classification usually means:
zerolabel solves this in one line of code.
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.
npm install zerolabel
// 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
});
await classify({
images: ['data:image/jpeg;base64,...'],
labels: ['cat', 'dog', 'bird'],
apiKey: process.env.INFERENCE_API_KEY
});
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
});
await classify({
texts: ['Fix login bug', 'Add dark mode', 'Server is down!'],
labels: ['bug_report', 'feature_request', 'incident'],
apiKey: process.env.INFERENCE_API_KEY
});
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:
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) |
Powered by inference.net infrastructure
[
{
"text": "I love this product!",
"predicted_label": "positive",
"confidence": 95.2,
"probabilities": {
"positive": 0.952,
"negative": 0.048
}
}
]
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']
});
INFERENCE_API_KEY
environment variableexport INFERENCE_API_KEY="your-key-here"
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 |
Try it yourself: zerolabel.dev
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
Full TypeScript definitions included:
import type {
ClassificationInput,
ClassificationResult,
ZeroLabelConfig
} from 'zerolabel';
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.
Issues and PRs welcome! See our GitHub repo.
MIT - Use it however you want!
FAQs
Zero-shot multimodal classification SDK - classify text and images with custom labels, no training required
The npm package zerolabel receives a total of 647 weekly downloads. As such, zerolabel popularity was classified as not popular.
We found that zerolabel demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.