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.

CheckWhen it runsWhat it checksWhen something is flagged
blockContentBefore generationThe text and input images of your requestThe request fails with sensitiveContentDetected and is not charged
checkContentAfter generationThe generated image or videoThe result includes NSFWContent: true
Provider moderationAt the providerWhatever the provider's policy coversThe task fails with invalidProviderContent and is not charged
Content involving minorsOn every image, video and audio taskThe content of the taskThe 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.

Request
[
  {
    "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 as negativePrompt, 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. parameter gives the field, such as positivePrompt, speech.text or inputs.referenceImages[1].

An input image could not be read, so it could not be moderated. parameter gives the field.

Moderation could not reach a verdict, so the request was not processed.

The task has more than 100 input images or 1,000 text values.

Error
{
  "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.

Response
{
  "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.