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.
chevron_leftchevron_right
Inputs to classify
For text, it can be a sentence up to 8192 tokens. For images, it can be a URL or a base64-encoded image.
upload
Request
curl https://api.jina.ai/v1/classify \
-H "Content-Type: application/json" \
-H "Authorization: Bearer " \
-d @- <<EOFEOF
{
"input": [
"Calculate the compound interest on a principal of $10,000 invested for 5 years at an annual rate of 5%, compounded quarterly.",
"分析使用CRISPR基因编辑技术在人类胚胎中的伦理影响。考虑潜在的医疗益处和长期社会后果。",
"AIが自意識を持つディストピアの未来を舞台にした短編小説を書いてください。人間とAIの関係や意識の本質をテーマに探求してください。",
"Erklären Sie die Unterschiede zwischen Merge-Sort und Quicksort-Algorithmen in Bezug auf Zeitkomplexität, Platzkomplexität und Leistung in der Praxis.",
"Write a poem about the beauty of nature and its healing power on the human soul.",
"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"
}
EOFEOF
API Pricing
API pricing is based on token usage - input tokens for standard APIs and output tokens for Reader API. One API key gives you access to all search foundation products.
Rate Limit
Rate limits are tracked in two ways: RPM (requests per minute) and TPM (tokens per minute). Limits are enforced per IP and can be reached based on whichever threshold—RPM or TPM—is hit first.
Product | API Endpoint | Descriptionarrow_upward | w/o API Key | w/ API Key | w/ Premium API Key | Average Latency | Token Usage Counting | Allowed Request | |
---|---|---|---|---|---|---|---|---|---|
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 | block | 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 | 22.7s | Count the total number of tokens in the whole process. | GET/POST | |
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 (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 | |
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 | |
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?
keyboard_arrow_down
What's num_iters for and how should I use it?
keyboard_arrow_down
How does public classifier sharing work?
keyboard_arrow_down
How much data do I need for few-shot to work well?
keyboard_arrow_down
Can it handle multiple languages and both text/images?
keyboard_arrow_down
What are the hard limits I should know about?
keyboard_arrow_down
How do I handle data changes over time?
keyboard_arrow_down
What happens to my training data after I send it?
keyboard_arrow_down
Zero-shot vs few-shot - when to use which?
keyboard_arrow_down
Can I use different models for different languages/tasks?
keyboard_arrow_down
API-related common questions
code
Can I use the same API key for embedding, reranking, reader, fine-tuning APIs?
keyboard_arrow_down
code
Can I monitor the token usage of my API key?
keyboard_arrow_down
code
What should I do if I forget my API key?
keyboard_arrow_down
code
Do API keys expire?
keyboard_arrow_down
code
Why is the first request for some models slow?
keyboard_arrow_down
code
Is user input data used for training your models?
keyboard_arrow_down
Billing-related common questions
attach_money
Is billing based on the number of sentences or requests?
keyboard_arrow_down
attach_money
Is there a free trial available for new users?
keyboard_arrow_down
attach_money
Are tokens charged for failed requests?
keyboard_arrow_down
attach_money
What payment methods are accepted?
keyboard_arrow_down
attach_money
Is invoicing available for token purchases?
keyboard_arrow_down