An AI content moderation API where you write the rulebook
Fixed-taxonomy toxicity endpoints enforce someone else’s generic categories. Clef-Flash evaluates posts, JSON metadata and images against your exact community criteria and returns calibrated probabilities you can threshold.
Your export tool works fine on CSVs, regular crashes on Parquet, and whoever wrote the retry banner clearly never ran it once.
curl --fail-with-body https://clef-flash.com/api/v1/decisions \
-H "authorization: Bearer $CLEF_API_KEY" \
-H "content-type: application/json" \
--data-binary @- <<'CLEF_DECISION'
{
"model": "cloudflare/clef-flash",
"threshold": 0.9,
"state": "Your export tool works fine on CSVs, regular crashes on Parquet, and whoever wrote the retry banner clearly never ran it once.",
"questions": {
"violates_policy": {
"type": "noul",
"instructions": "Does this post break community rules on personal attacks, spam or off-platform payment fraud?",
"criteria": {
"true": "attacks an individual, promotes unsolicited links/codes, or solicits off-platform payment",
"false": "discusses the product, even harshly, without personal abuse, spam or payment diversion"
}
},
"policy_category": {
"type": "choice",
"instructions": "Which moderation bucket fits this post best?",
"criteria": {
"harassment": "personal attack or targeted insult against a person",
"spam": "affiliate code, referral link or repetitive promotion",
"scam": "off-platform payment request, phishing or escrow bypass",
"clean": "on-topic product criticism, question or feedback"
}
}
}
}
CLEF_DECISION
Ship this in production with a $19 Pro key
2,000 decisions/day, 8 concurrent requests in flight, text + JSON + image states, and an API key emailed in about a minute.
Why fixed moderation taxonomies fail real communities
Every marketplace, developer forum and gaming community has rules a generic hate-and-violence classifier knows nothing about: off-platform wire solicitation, leaked invite codes, spoilers in titles, AI-generated homework dumps, or personal insults disguised inside bug reports. Hard-coded moderation APIs force you tobolt brittle regexes onto a fixed label list.
With a decision model, your policy lives in the request criteria. A noul question asks for the exact probability that a submission breaks your rule, while a companion choice question assigns the policy bucket in the very same forward pass — no prompt engineering, no prose refusals and no JSON parsing failures.
Three-band moderation: publish, review, or block
Binary moderation forces an ugly trade-off: set the bar low and angry false-positive users flood support; set it high and spam sits on the homepage for hours. Calibrated probabilities turn moderation into two explicit product numbers — an auto-publish ceiling (p_allow) and an auto-block floor (p_block).
Submissions below p_allow publish in milliseconds with zero moderator cost. Submissions at or above p_block are rejected automatically with a traceable category. Only the ambiguous middle lands in your human review queue, already tagged with its highest-probability policy area so moderators spend seconds instead of minutes.
- Below p_allow (for example < 0.35): publish immediately, zero human queue.
- Between p_allow and p_block: hold for moderator review with pre-scored category.
- At or above p_block (for example >= 0.90): block automatically and log the distribution.
Moderation approaches compared
Because Clef-Flash ships with a native vision encoder, paid API keys can send text, user metadata (account age, prior strikes, link count) and up to four 4 MiB images in a single request up to 24,576 served tokens (64K on the published model card; 120,000 characters enforced before billing).
| Approach | Custom product rules | Output contract | Multimodal state | Model cost @ 1M posts |
|---|---|---|---|---|
| Legacy toxicity API | No — fixed vendor labels | Fixed scores only | Text only on most tiers | Low, misses custom spam/scams |
| Frontier chat LLM | Yes, via long system prompt | Free text / fragile JSON | Yes, slow & expensive | ~$1,200+ input & output |
| Clef-Flash Decision API | Yes, per-label criteria | Closed-set probabilities | Text, JSON & up to 4 images | ~$7.22 input ($0 output) |
Privacy, auditability, and predictable refusal codes
User-generated content often carries personal details. This deployment records request counts, model IDs and latency for your usage meter — never the text or images inside your state. Every error uses a stable machine-readable code (such as state_too_large, quota_exceeded or model_unavailable) with a matching x-request-id header, and refused calls are never billed.
Frequently asked questions
Can Clef-Flash moderate images and text together in one call?
Yes on paid API keys (starting with the $19 Pro plan). Both cloudflare/clef-flash and cloudflare/clef include a vision encoder and accept up to four images (4 MiB each) alongside text or JSON context in one decision call.
Do you store or train on user comments sent to the API?
No. The Worker meters call counts, token usage, latency and status codes per API key; it does not persist customer states or user submissions in the database.
How many moderation rules can I evaluate in a single request?
Up to eight typed questions per call, where each choice question can declare two to twelve policy categories with up to 300 characters of guidance per category. All questions in one call count as a single decision against your daily plan quota.
What happens if a post exceeds the context limit?
Paid calls enforce a 120,000-character ceiling on cloudflare/clef-flash (inside its 24,576 served tokens, versus 64K on the model card) and answer 413 state_too_large before invoking the model, so an attacker pasting megabytes cannot trigger silent truncation or unexpected token spend.
Keep reading
Model notes
One short email when a new decision model lands or a benchmark changes. No spam, unsubscribe in one click.