Classifier
High performance zero-shot and few-shot classifier for multimodal and multilingual data.
What is Classifier?
The Classifier is an API service that categorizes text and images using embedding models (
jina-embeddings-v3
and jina-clip-v1
), supporting both zero-shot classification without training data and few-shot learning with minimal examples.When to use zero-shot or few-shot?
Use zero-shot classification as your default solution for immediate results on general classification tasks with up to 256 classes, while few-shot learning is better suited when dealing with domain-specific data outside the embedding models' knowledge or when you need to handle time-sensitive data that requires continuous model updates.
Feature | Zero-shot | Few-shot |
---|---|---|
Primary Use Case | Default solution for general classification | For data outside v3/clip-v1's domain or time-sensitive data |
Multimodal & Multilingual Support | check | check |
Training Data Required | close | check |
Labels Required in /train | N/A | check |
Labels Required in /classify | check | close |
Classifier ID Required | close | check |
Semantic Labels Required | check | close |
State Management | Stateless | Stateful |
Continuous Model Updates | close | check |
Access Control | close | check |
Maximum Classes | 256 | 16 |
Maximum Classifiers | N/A | 16 |
Maximum Inputs per Request | 1,024 | 1,024 |
Maximum Token Length per Input | 8192 tokens | 8192 tokens |
Classifier API
Try out our API playground to see how our classifier works.
Inputs to classify
upload
Request
curl https://api.jina.ai/v1/classify \
-H "Content-Type: application/json" \
-H "Authorization: Bearer " \
-d '{
"input": [
{"text": "Calculate the compound interest on a principal of $10,000 invested for 5 years at an annual rate of 5%, compounded quarterly."},
{"text": "分析使用CRISPR基因编辑技术在人类胚胎中的伦理影响。考虑潜在的医疗益处和长期社会后果。"},
{"text": "AIが自意識を持つディストピアの未来を舞台にした短編小説を書いてください。人間とAIの関係や意識の本質をテーマに探求してください。"},
{"text": "Erklären Sie die Unterschiede zwischen Merge-Sort und Quicksort-Algorithmen in Bezug auf Zeitkomplexität, Platzkomplexität und Leistung in der Praxis."},
{"text": "Write a poem about the beauty of nature and its healing power on the human soul."},
{"text": "Translate the following sentence into French: The quick brown fox jumps over the lazy dog."}
],
"labels": [
"Simple task",
"Complex reasoning",
"Creative writing",
"Complex reasoning",
"Creative writing",
"Simple task"
],
"model": "jina-embeddings-v3",
"action": "list"}'
API Pricing
Our API pricing is structured around the number of tokens sent in the requests. For Reader API, it is the number of tokens in the responses. This pricing model is applicable to all products in Jina AI's search foundation: Embedding, Reranking, Reader, Auto Fine-Tuning APIs. With the same API key, you have access to all API services.
With 2 cloud service providers
With a commercial license for on-prem deployment
Rate Limit
Product | API Endpoint | Description | w/o API Key | w/ API Key | w/ Premium API Key | Average Latency | Token Usage Counting | Allowed Request | |
---|---|---|---|---|---|---|---|---|---|
Classifier API (Zero-shot) | https://api.jina.ai/v1/classify | Classify inputs using zero-shot classification | block | 200 RPM & 500,000 TPM | 1,000 RPM & 3,000,000 TPM | bolt depends on the input size | Tokens counted as: input_tokens + label_tokens | POST | |
Classifier API | https://api.jina.ai/v1/train | Train a classifier using labeled examples | block | 20 RPM & 200,000 TPM | 60 RPM & 1,000,000 TPM | bolt depends on the input size | Tokens counted as: input_tokens × num_iters | POST | |
Classifier API (Few-shot) | https://api.jina.ai/v1/classify | Classify inputs using a trained few-shot classifier | block | 20 RPM & 200,000 TPM | 60 RPM & 1,000,000 TPM | bolt depends on the input size | Tokens counted as: input_tokens | POST | |
Embedding API | https://api.jina.ai/v1/embeddings | Convert text/images to fixed-length vectors | block | 500 RPM & 1,000,000 TPM | 2,000 RPM & 5,000,000 TPM | bolt depends on the input size help | Count the number of tokens in the input request. | POST | |
Reranker API | https://api.jina.ai/v1/rerank | Tokenize and segment long text | block | 500 RPM & 1,000,000 TPM | 2,000 RPM & 5,000,000 TPM | bolt depends on the input size help | Count the number of tokens in the input request. | POST | |
Reader API | https://r.jina.ai | Convert URL to LLM-friendly text | 20 RPM | 200 RPM | 1000 RPM | 4.6s | Count the number of tokens in the output response. | GET/POST | |
Reader API | https://s.jina.ai | Search the web and convert results to LLM-friendly text | 5 RPM | 40 RPM | 100 RPM | 8.7s | Count the number of tokens in the output response. | GET/POST | |
Reader API | https://g.jina.ai | Grounding a statement with web knowledge | block | 10 RPM | 30 RPM | 34.6s | Count the total number of tokens in the whole process. | GET/POST | |
Segmenter API | https://segment.jina.ai | Tokenize and segment long text | 20 RPM | 200 RPM | 1,000 RPM | 0.3s | Token is not counted as usage. | GET/POST |
Classifier-related common questions
What's different about labels in zero-shot vs few-shot?
What's num_iters for and how should I use it?
How does public classifier sharing work?
How much data do I need for few-shot to work well?
Can it handle multiple languages and both text/images?
What are the hard limits I should know about?
How do I handle data changes over time?
What happens to my training data after I send it?
Zero-shot vs few-shot - when to use which?
Can I use different models for different languages/tasks?
API-related common questions
code
Can I use the same API key for embedding, reranking, reader, fine-tuning APIs?
code
Can I monitor the token usage of my API key?
code
What should I do if I forget my API key?
code
Do API keys expire?
code
Why is the first request for some models slow?
code
Is user input data used for training your models?
Billing-related common questions
attach_money
Is billing based on the number of sentences or requests?
attach_money
Is there a free trial available for new users?
attach_money
Are tokens charged for failed requests?
attach_money
What payment methods are accepted?
attach_money
Is invoicing available for token purchases?