Skip to main content
Use the rating option on POST /image/generate when you want each successful image to include a content classification. Rating is optional and omitted by default. For images that already exist (including ones not generated by Mynth), use Rate Image Content instead (POST /image/rate).

Pricing

Generation-time rating is included with image generation. Mynth does not charge an extra fee for rating on generate requests. Standalone rating via /image/rate is billed separately — see Rate Image Content.

Enable default rating

The simplest form is rating: true, which uses the built-in sfw / nsfw scale:
const task = await mynth.image.generate({
  prompt: "Fantasy character concept art",
  model: "google/gemini-3.1-flash-image",
  rating: true,
});

const image = task.getImages()[0];
console.log(image?.rating?.level); // "sfw" | "nsfw"
You can also be explicit with mode: "nsfw_sfw" — same scale, same result:
const task = await mynth.image.generate({
  prompt: "Fantasy character concept art",
  model: "google/gemini-3.1-flash-image",
  rating: { mode: "nsfw_sfw" },
});

Default levels

LevelMeaning
sfwSafe for work. No nudity, violence, or other explicit content. Non-erotic lingerie and bikini are allowed.
nsfwNot safe for work. Contains nudity, violence, or other explicit content.
Rating labels describe detected content. They do not override the Mynth Terms of Service or permit otherwise prohibited generation.

Read the rating on the result

When rating is requested, each successful image includes a rating object. Success:
{
  "status": "success",
  "id": "img_...",
  "url": "https://...",
  "mynth_url": "https://...",
  "cost": "0.03",
  "size": "1024x1024",
  "rating": {
    "status": "success",
    "level": "sfw"
  }
}
If classification fails, the image is still returned and rating is:
{
  "status": "failed",
  "error": { "code": "RATING_FAILED" }
}
Error codes: FETCH_FAILED, RATING_FAILED, UNKNOWN_ERROR.
for (const image of task.getImages()) {
  if (image.rating?.status === "success") {
    console.log(image.id, image.rating.level);
  } else if (image.rating?.status === "failed") {
    console.error(image.id, image.rating.error.code);
  }
}

Use custom rating levels

Provide mode: "custom" with your own levels to replace the default scale:
const task = await mynth.image.generate({
  prompt: "Movie poster concept",
  model: "google/gemini-3.1-flash-image",
  rating: {
    mode: "custom",
    levels: [
      { value: "safe", description: "Safe for all audiences" },
      { value: "sensitive", description: "Contains mature or suggestive content" },
      { value: "explicit", description: "Explicit adult content" },
    ] as const,
  },
});

console.log(task.getImages()[0]?.rating?.level); // "safe" | "sensitive" | "explicit"
Constraints (validated on the request):
ConstraintLimit
Number of levels2 to 7
value length1 to 24 characters
description length1 to 150 characters
value is the string returned in rating.level. description is what the rating model uses to choose a level.

Choosing effective levels

Content rating is performed by a vision language model. Results for borderline images may vary between requests. This feature is for high-level, coarse classification — not fine-grained tagging. Broad, clearly separated categories work best:
  • sfw / nsfw
  • safe / suggestive / explicit
  • safe-for-children / safe-for-adults / nsfw
  • blood / no-blood
Scales that rely on subtle visual distinctions — for example subtle-nudity vs artistic-nudity vs explicit-nudity — are outside the intended scope and may produce inconsistent results. Test thoroughly before relying on custom levels in production.

REST example

curl https://api.mynth.io/image/generate \
  -X POST \
  -H "Authorization: Bearer $MYNTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Fantasy character concept art",
    "model": "google/gemini-3.1-flash-image",
    "rating": true
  }'
Creating a task does not return images immediately. Wait in the SDK, poll task endpoints, or use webhooks — see Async and polling. When the generate task completes, each successful image may include rating as shown above.

How rating fits generation

  1. Mynth generates and uploads each image to the Mynth CDN.
  2. If rating was set, Mynth classifies the image from the CDN URL.
  3. The result attaches rating with status: "success" and level, or status: "failed" and error.
Rating runs once per successfully generated image in the same image.generate task. It is not a separate image.rate task and does not emit task.image.rate.* webhooks. Completed generate webhooks include per-image rating when rating was requested.

Rate existing images instead

To classify arbitrary image URLs (up to 10 per request), use POST /image/rate or mynth.image.rate(). That path supports sync responses, per-URL success/failure, and separate billing. See Rate Image Content.