Content Safety
The checks a request can go through for unsafe content: before generation, on the generated output, at third-party providers, and for content involving minors.
Introduction
A request can be checked for unsafe content at four points. Two of them are options you set per request in the safety object: blockContent checks what you send before anything is generated, and checkContent checks what the model generated. The other two always apply: a third-party provider can reject a request under its own policy, and content involving minors is blocked on every request.
| Check | When it runs | What it checks | When something is flagged |
|---|---|---|---|
blockContent | Before generation | The text and input images of your request | The request fails with sensitiveContentDetected and is not charged |
checkContent | After generation | The generated image or video | The result includes NSFWContent: true |
| Provider moderation | At the provider | Whatever the provider's policy covers | The task fails with invalidProviderContent and is not charged |
| Content involving minors | On every image, video and audio task | The content of the task | The result is withheld and the task fails with sensitiveContentDetected |
Blocking content before generation
Set safety.blockContent to true to have the text and input images of a request moderated before the task starts. A flagged request is rejected before any model runs, so there is no output and no charge. The option is available on every image and video model.
[
{
"taskType": "imageInference",
"taskUUID": "a770f077-f413-47de-9dac-be0b26a35da6",
"model": "runware:400@1",
"positivePrompt": "a red car parked on a quiet street",
"width": 1024,
"height": 1024,
"safety": {
"blockContent": true
}
}
]What is moderated
- Text. The prompt and any other text the model receives, such as a speech script or a text setting under
providerSettings. Text that tells the model what to avoid, such asnegativePrompt, is not moderated. - Input images in any parameter that takes one, such as reference images or frame images. An image sent by URL, by media storage UUID or as base64 is moderated the same way.
- Input videos, audio and documents are not moderated. A request that includes them is checked on its text and images only.
Content is flagged for sexual content, sexual content involving minors and graphic violence. Moderation adds about a second before the task starts, and 2 to 4 seconds when the request includes input images.
Errors
Something in the request was flagged.
parametergives the field, such aspositivePrompt,speech.textorinputs.referenceImages[1].
An input image could not be read, so it could not be moderated.
parametergives the field.
The task has more than 100 input images or 1,000 text values.
{
"data": [],
"errors": [
{
"code": "sensitiveContentDetected",
"message": "Request blocked. The prompt was flagged for content that violates our safety policies.",
"parameter": "positivePrompt",
"type": "string",
"taskUUID": "a770f077-f413-47de-9dac-be0b26a35da6"
}
]
}Checking generated content
Set safety.checkContent to true to check what the model generated. Each result then includes NSFWContent, which is true when the output was flagged. The check makes generation take longer and adds a small charge on top of the generation cost.
{
"data": [
{
"taskType": "imageInference",
"taskUUID": "a770f077-f413-47de-9dac-be0b26a35da6",
"imageUUID": "8b3965e7-197c-4217-98de-d60f088450c6",
"imageURL": "https://im.runware.ai/image/os/a02d21/ws/3/ii/8b3965e7-197c-4217-98de-d60f088450c6.jpg",
"seed": 1539788978,
"NSFWContent": false,
"cost": 0.013
}
]
}For video, safety.mode sets how much of the output is checked. fast checks key frames and is the default, and full checks every frame. mode is only accepted together with checkContent: true.
Provider moderation
Third-party providers run their own moderation on the models they serve, whatever you set in safety. Each provider decides what it rejects, so the same request can pass on one model and fail on another. A provider can reject the request itself or the content it generated.
A rejected task fails with invalidProviderContent, and the message includes the provider's name. As with any failed task, it is not charged. Content that blockContent flags is rejected before the request reaches the provider.
Content involving minors
Every image, video and audio task is checked for sexual content involving minors, whatever the safety settings say. When it is detected, the result is withheld and the task fails with sensitiveContentDetected. This check can't be turned off.