Policies
Send your moderation settings with the request and get a blocked verdict, computed exactly like the SfwBot Discord bot does.
A policy turns scores into a decision on our side, so your code does not have to re-implement the rules:
{ "policy": { "block_level": 2, "block_sex_objects": true, "art": "block_from_3" } }| Field | Values | Meaning |
|---|---|---|
block_level | 1, 2, 3 | Block media at this level or above. |
block_sex_objects | boolean | Also block when an adult object is detected. Default false. |
art | same_as_photos, allow, block_from_1, block_from_2, block_from_3 | How frames the model flags as art are judged. Default same_as_photos. |
The response then carries:
{ "policy": { "blocked": true, "reason": "level", "matched_level": 2 } }reason is level (a level at or above block_level), sex_object, or art_level (a level reached under the art rule). matched_level is the highest blocked level seen in any frame.
How it is evaluated
For every analysed frame: if the frame is art (art score above 50) and the art rule is not same_as_photos, the art rule decides the level to block from (allow skips the frame). The frame's score is the maximum of the level scores at or above that level, plus the adult-object score when block_sex_objects is on. The media is blocked when any frame's score is above 50. This is a line-for-line port of the evaluator the SfwBot Discord bot applies to each server's settings, so a policy that works for a community in Discord works the same here.
Typical policies
| Community | Policy |
|---|---|
| General audience, art welcome | { "block_level": 1, "block_sex_objects": true, "art": "block_from_2" } |
| Adults, no explicit content | { "block_level": 3, "block_sex_objects": false } |
| Swimwear fine, nudity not | { "block_level": 2, "block_sex_objects": true } |
| Dating profile photos | { "block_level": 2, "block_sex_objects": true, "art": "block_from_1" } |
You can also evaluate policies client-side from the returned scores; the TypeScript SDK exports the same evaluatePolicy function.