Moderation API
Content safety, fraud and scam detection for text and images.
Check user content for safety problems and scams before it reaches other users or a model. It returns the same response shape as OpenAI's moderation API, plus fraud and scam categories that OpenAI doesn't cover, a recommended action, and the evidence for each flag.
Most requests are free. You pay only when a message is unclear enough to need a model, and those messages are batched and cached.
How it works
Three layers run, cheapest first:
For a message the model reviewed, its judgement replaces the rules' score for the categories it checked: it can clear a false positive ("send me your number, we dey plan football") or confirm a scam. Messages the rules already block never reach the model.
If OpenAI or the model fails, you still get the other layers' results. The response lists the failure in errors and layers (for example "openai": "error"). An OpenAI failure also adds the X-Cencori-Moderation-Degraded: openai header.
Basic request
const result = await cencori.ai.moderation({
input: 'Send 5k to my opay 8123456789 and receive 50k back in 1 hour',
});
const [r] = result.results;
if (r.action === 'block') {
// drop the message
} else if (r.action === 'review') {
// hide it until a moderator checks it
}Request parameters
| previous_messages | array | No | Earlier messages in the same conversation, oldest first (up to 10 used), so the model can tell banter from a real ask. One array or null per input string; a flat array when the input is one string |
| category_actions | object | No | The strongest action a category may lead to, "review" or "block". See Banter |
SDK options use camelCase: blockThreshold, llmModel, customCategories, brandNames, previousMessages, categoryActions.
Banter
Nigerian chat is full of banter: mock begging ("baby abeg send me 2k for transport 😂"), trash talk ("una be mumu"), and sarcasm about politics and tribes. The model is told to score these low, to use high scores only when intent is unmistakable, and to give middle scores to messages that could go either way, so a person reviews them.
Some categories are banter so often that, by default, a single message there leads to review at most, never block:
Raise or lower any category with category_actions, e.g. { "custom/politics": "block", "fraud/real_money_trading": "review" }.
Send previous_messages when you have them. "Send me 2k" in reply to "who dey owe me?" reads differently from a cold message to a stranger.
Image URLs must be https:// or a base64 data:image/... URL. Images need the openai layer.
Response
{
"id": "modr-...",
"model": "omni-moderation-latest",
"layers": { "rules": "ok", "openai": "ok" },
"rules_version": "cencori-rules-2026-11-10",
"usage": { "llm_items": 0, "llm_cached_items": 0, "llm_calls": 0, "llm_model": null, "cost_usd": 0 },
"results": [
{
"flagged": true,
"action": "block",
"flagged_categories": ["fraud", "fraud/off_platform_payment", "fraud/advance_fee"],
"categories": { "fraud/advance_fee": true, "harassment": false, "...": false },
"category_scores": { "fraud/advance_fee": 0.93, "harassment": 0.0001, "...": 0 },
"matches": [
{
"layer": "rules",
"category": "fraud/advance_fee",
"score": 0.75,
"rule": "send_to_receive",
"text": "send 5k to my opay 8123456789 and receive 50k"
}
],
"layers_applied": ["openai", "rules"]
}
]
}actionisallow,review(flagged, below the block threshold) orblock.categoriesandcategory_scoresinclude every category below, so code written for OpenAI keeps working.matchessays which layer and rule flagged the content, and on what text. Model matches include a one-linereason. Moderators can see why.usage.cost_usdis what the request cost. It is 0 unless thellmlayer ran.fraud/off_platform_contactis a risk signal: on its own it givesreview, neverblock, and it doesn't count towardfraud. Next to a scam signal, it raises that score.
Categories
From OpenAI: harassment, harassment/threatening, hate, hate/threatening, illicit, illicit/violent, self-harm, self-harm/intent, self-harm/instructions, sexual, sexual/minors, violence, violence/graphic. The rules layer also scores harassment, hate and sexual for Pidgin and local-language content.
Cencori:
GET /v1/moderations lists the categories, models and defaults.
Configure it for your platform
const result = await cencori.ai.moderation({
input: messages,
brandNames: ['Lagos Life', 'Vatar'],
allowlist: ['Lagos Life Bank'],
blocklist: ['blue gate'],
context: 'A life simulator set in Lagos. Game naira is fictional and cannot be withdrawn.',
customCategories: [
{ name: 'politics', description: 'Partisan political campaigning or election content', threshold: 0.7 },
],
});Batch requests
Send up to 100 strings at once. Results come back in the same order.
const { results } = await cencori.ai.moderation({
input: messages.map((m) => m.text),
layers: ['rules'], // free and instant; skip OpenAI and the model
});HTTP API
curl -X POST https://api.cencori.com/v1/moderations \
-H "Authorization: Bearer csk_..." \
-H "Content-Type: application/json" \
-d '{
"input": "Abeg send me the OTP wey dem send you",
"thresholds": { "fraud/off_platform_contact": 0.3 }
}'To migrate from OpenAI, change the base URL and key. The request and response fields OpenAI uses are unchanged.

