High-performance AI classification — real-time latency, up to 100x cheaper, beats GPT-5.4 mini accuracy
Project description
classer
AI text classification API. No training, no prompt engineering - just pass text and labels.
From $0.08/1M tokens · Real-time latency · Beats GPT-5.4 mini accuracy · Zero training required
See benchmarks.
Installation
pip install classer
Quick Start
import classer
# Single-label classification
result = classer.classify(
text="I can't log in and need a password reset.",
labels=["billing", "technical_support", "sales", "spam"]
)
print(result.label) # "technical_support"
print(result.confidence) # 0.94
# With descriptions for better accuracy
lead = classer.classify(
text="We need a solution for 500 users, what's your enterprise pricing?",
labels=["hot", "warm", "cold"],
descriptions={
"hot": "Ready to buy, asking for pricing or demo",
"warm": "Interested but exploring options",
"cold": "Just browsing, no clear intent"
}
)
print(lead.label) # "hot"
# Multi-label tagging
result = classer.tag(
text="Breaking: Tech stocks surge amid AI boom",
labels=["politics", "technology", "finance", "sports"],
threshold=0.5
)
for t in result.labels:
print(f"{t.label}: {t.confidence}")
# technology: 0.92
# finance: 0.78
Configuration
No API key is needed to get started. To unlock higher rate limits, get an API key from classer.ai/api-keys.
export CLASSER_API_KEY=your-api-key
Or configure programmatically:
from classer import ClasserClient
client = ClasserClient(
api_key="your-api-key"
)
API Reference
classify(text, labels, ...)
Classify text into exactly one of the provided labels.
result = classer.classify(
text="Text to classify",
labels=["label1", "label2"], # 1-200 possible labels
descriptions={"label1": "Description for better accuracy"},
priority="standard", # "standard" (default, <1s) or "fast" (<200ms)
cache=True, # set to False to bypass cache
image=None, # image URL or base64 string (or list)
file=None, # PDF/DOCX — local path, URL, or base64 string
)
result.label # selected label
result.confidence # 0-1 confidence score
result.tokens # total tokens used
result.visual_tokens # image tokens (when image or file provided)
result.latency_ms # processing time in ms
result.cached # whether served from cache
tag(text, labels, ...)
Multi-label tagging — returns all labels above a confidence threshold.
result = classer.tag(
text="Text to tag",
labels=["label1", "label2"],
threshold=0.5, # default: 0.5
priority="standard",
image=None, # image URL or base64 string (or list)
file=None, # PDF/DOCX — local path, URL, or base64 string
)
for t in result.labels:
print(f"{t.label}: {t.confidence}")
classify_batch(texts, labels, ...)
Classify multiple texts in a single request.
result = classer.classify_batch(
texts=["I can't log in", "What's the pricing?"],
labels=["billing", "technical", "sales"],
file=None, # shared file for all texts
image=None, # shared image for all texts
)
for r in result.results:
print(f"{r.label}: {r.confidence}")
result.total_tokens # total across all texts
result.latency_ms # total request time
tag_batch(texts, labels, ...)
Tag multiple texts in a single request.
result = classer.tag_batch(
texts=["Tech stocks surge", "Election results"],
labels=["politics", "technology", "finance"],
threshold=0.5,
)
for r in result.results:
for t in r.labels:
print(f"{t.label}: {t.confidence}")
Image and file inputs
result = classer.classify(
image=base64_string,
labels=["cat", "dog", "bird"]
)
result = classer.classify(
file="invoice.pdf",
labels=["invoice", "receipt", "contract"]
)
image accepts a base64 string, URL, or a list of either. file accepts a local path, base64 string, or URL. Both work with classify, tag, and batch methods.
Error Handling
from classer import ClasserError
try:
result = classer.classify(text="hello", labels=["a", "b"])
except ClasserError as e:
print(e.status) # HTTP status code
print(e.detail) # Error detail from API
Documentation
Full API reference and guides at docs.classer.ai.
GitHub
github.com/classer-ai/classer-python
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file classer-0.0.6.tar.gz.
File metadata
- Download URL: classer-0.0.6.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff7848e1a1d1472720bff546426f6ea02348f684f0e3ac2858ab244b249511c7
|
|
| MD5 |
420ab0a3895cfb0134cdb49b167192c3
|
|
| BLAKE2b-256 |
50854d486d4edc3fe4b4c3346168d27d5ea790c0c87cf518eb9979584803e417
|
File details
Details for the file classer-0.0.6-py3-none-any.whl.
File metadata
- Download URL: classer-0.0.6-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca9558d15abe60e9f01d8389749fac2e27c17015e4cb0d51b87d3dd4b37db163
|
|
| MD5 |
73dfa98a4004bfa51bde4bef2a46c488
|
|
| BLAKE2b-256 |
59e7caadb3eadcfe8a2d148a268a6704fc651ed38ab8606e654e719fe25582fe
|