Skip to main content
POST
https://api.classer.ai
/
v1
/
score
Score
curl --request POST \
  --url https://api.classer.ai/v1/score \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "source": "<string>",
  "attribute": "<string>",
  "description": "<string>",
  "model": "<string>"
}
'
{
  "score": 0.9234,
  "latency_ms": 125,
  "usage": {
    "prompt_tokens": 35,
    "completion_tokens": 1,
    "total_tokens": 36
  }
}

Request

source
string
required
The text to score
attribute
string
required
The attribute to score (e.g., “urgency”, “toxicity”, “quality”)
description
string
Optional description of the attribute for better accuracy
model
string
Model override (optional)

Response

score
number
Score between 0 and 1
latency_ms
number
Processing time in milliseconds
usage
object
Token usage information

Common Attributes

AttributeDescription
urgencyHow urgent is the message
toxicityLevel of toxic/offensive content
sentimentPositive sentiment (1) vs negative (0)
formalityHow formal is the writing
qualityContent quality
spamLikelihood of being spam

Examples

Urgency scoring

import classer

result = classer.score(
    source="URGENT! Server is down! Need help NOW!",
    attribute="urgency"
)

print(result.score)  # 0.95

Toxicity detection

# Toxic content
result = classer.score(
    source="You're an idiot and your product is garbage",
    attribute="toxicity"
)
print(result.score)  # 0.89

# Non-toxic content
result = classer.score(
    source="Thank you for your help, I really appreciate it!",
    attribute="toxicity"
)
print(result.score)  # 0.08

Custom attribute with description

result = classer.score(
    source="I've been waiting 3 weeks for my order",
    attribute="frustration",
    description="Level of customer frustration or dissatisfaction"
)

print(result.score)  # 0.72

Prioritizing support tickets

Python
import classer

tickets = [
    "When will the new feature be released?",
    "URGENT: Production database is corrupted!",
    "How do I change my email address?",
]

# Score urgency for each ticket
for ticket in tickets:
    result = classer.score(source=ticket, attribute="urgency")
    print(f"{result.score:.2f} - {ticket[:40]}...")

# Output:
# 0.15 - When will the new feature be released?...
# 0.98 - URGENT: Production database is corrupted...
# 0.12 - How do I change my email address?...
{
  "score": 0.9234,
  "latency_ms": 125,
  "usage": {
    "prompt_tokens": 35,
    "completion_tokens": 1,
    "total_tokens": 36
  }
}