Request
The text to classify (max 1M tokens). Required unless an image or file is provided.
Image(s) to classify — URL (https://...) or base64-encoded string. Images above 4MP (2048×2048) are resized. Max 20 images.
PDF or DOCX file — URL or base64-encoded string. Text is extracted and each page is converted to an image for visual analysis. Max 20 pages.
List of possible labels (1–200, max 100 characters each). Required unless classifier is provided.
Saved classifier name (e.g. "support-tickets") or a pinned version ("support-tickets@v2"). Alternative to providing labels inline.
Optional descriptions for each label to improve accuracy. Keys are label names, values are description strings.
Optional per-label example texts to improve accuracy. Keys are label names, values are arrays of example strings.
Optional context for prompt tuning (e.g. "app review", "support ticket")
Priority level: standard (<1s, 0.20/1M tokens) or `fast` (<200ms, 0.60/1M tokens)
Set to false to bypass cache and force a fresh classification
Response
Confidence score between 0 and 1 (rounded to 4 decimal places)
Number of visual (image) tokens used. Only present when an image is provided.
Processing time in milliseconds
Whether the response was served from cache
Examples
Basic classification
import classer
result = classer.classify(
text="I can't log in to my account",
labels=["billing", "technical", "sales"]
)
print(result.label) # "technical"
print(result.confidence) # 0.94
With descriptions
Adding descriptions improves accuracy for ambiguous labels:
result = classer.classify(
text="We need pricing for 500 users",
labels=["hot", "warm", "cold"],
descriptions={
"hot": "Ready to buy, asking for pricing or demo",
"warm": "Interested but still exploring",
"cold": "Just browsing, no clear intent"
}
)
print(result.label) # "hot"
{
"label": "technical",
"confidence": 0.9423,
"tokens": 142,
"latency_ms": 87,
"cached": false
}