APIMODELSAPIMODELS

"Your prompt was blocked by the content safety policy": what to do

TL;DR Short answer: the model provider's safety system refused this request. Your API key, balance and parameters are fine, and a blocked request costs nothing. Sending the same thing again will usually be blocked again, so read which part was blocked (the prompt, the generated result or a reference image) and change that part.

Every image and video model runs its provider's safety checks at up to three points: on your prompt, on the reference images or videos you send, and on the picture or clip it generates. When one of them trips, the task ends with state "failed", failCode "CONTENT_MODERATION", and a failMsg that names the part that was blocked.

A blocked request is not charged. The credit reserved when the task was created is released in full, so you can rewrite and try again without paying for the attempt that failed.

In our error codes CONTENT_MODERATION is marked not retryable: the same prompt and the same images will almost always be refused again. The fix is to change the content, or move to a model whose rules fit what you are making.

Which part was blocked? Read the message

The wording differs between models, but it always falls into one of these groups. Search the failMsg for a phrase in the second column.

What was blockedThe message saysWhat to do
Your prompt"Your prompt was blocked by the content safety policy", "rejected by the upstream content safety system", "triggered the sensitive-word filter"Rewrite the prompt; see the next section
The result: the prompt passed, the picture did not"The generated image was filtered by the safety policy", "The generated images appear to be unsafe", "the output image may contain sensitive information"Each generation is different, so one retry sometimes passes; if it is filtered twice, change what the prompt asks the picture to show
A reference image (or the prompt)"Your prompt or reference image was blocked", "the input image may contain sensitive information", "change the image or prompt"Try a different image first
A real person in your reference media"a reference image or video appears to show a real, identifiable person"This model does not accept real people. Use an illustrated or synthetic face, or run the job on Seedance 2.0 / 2.0 Mini
Anything that reads as a minor"may involve the depiction of minors", "Prompts involving minors"Not supported on any model. Do not try to work around it
Nudity or sexual content"may involve nudity or sexual content"Not allowed on standard models; see the section on choosing a model

How to rewrite a prompt that was wrongly blocked

Most blocks on legitimate work come from a few words or details, not from the idea itself. Describe what the camera sees in neutral, concrete terms, and drop anything the picture does not need.

Remove real names. A celebrity, politician or other public figure in the prompt is one of the most common triggers; describe the look you want instead of naming the person. Remove brand names you do not own as well.

For clothing and product shots, state the purpose and the garment, not the body: "e-commerce catalogue photo, adult model wearing a one-piece swimsuit, full-length, front view, plain white background" reads very differently from a description of the model's body.

For action, horror or war scenes, describe movement, tension and atmosphere, and leave out wounds, blood and injuries.

For reference images, crop to what you actually need (the product, the outfit, the room) and leave out people who do not need to be there.

When to switch to another model

Each provider draws the line in a different place, so the same prompt can be refused by one model and accepted by another. Two cases come up often.

Real people in reference photos or videos. Some image and video models refuse any reference that shows a real, identifiable person, and retrying will not change that. Our Seedance 2.0 and Seedance 2.0 Mini (model ids seedance-2.0 and seedance-2.0-mini) accept real-person reference photos and videos.

Content that is legal but outside a strict model's comfort zone, such as swimwear, figure art or stylised violence. The Spicy models have more relaxed moderation: Seedream 5.0 Pro Spicy (same quality and request format as Seedream 5.0 Pro), Z-Image Spicy and Qwen Image Edit Spicy for images, and Wan 2.7 / Wan 2.2 Spicy for image-to-video. They still run the model's own safety system, and nothing involving minors is accepted on any model.

Handling it in your code

Branch on failCode, not on the message text, because the wording changes between models. When failCode is "CONTENT_MODERATION": do not retry the same input automatically, show failMsg to your user, and let them edit the prompt or swap the image. Retry automatically only on the codes marked retryable, such as UPSTREAM_BUSY and TIMEOUT. The full list of error codes is in the API docs.

Inicio rápido

cURL

# A blocked task, as returned when you poll it (video tasks: /v1/video/generations)
curl "https://api.apimodels.app/v1/images/generations?task_id=TASK_ID" \
  -H "Authorization: Bearer $APIMODELS_API_KEY"
# → { "code": 200, "data": { "taskId": "...", "state": "failed",
#       "failCode": "CONTENT_MODERATION",
#       "failMsg": "Your prompt was blocked by the content safety policy. Please adjust your prompt and try again." } }

Python

import os, requests

H = {"Authorization": f"Bearer {os.environ['APIMODELS_API_KEY']}"}
d = requests.get("https://api.apimodels.app/v1/images/generations",
                 headers=H, params={"task_id": task_id}).json()["data"]

if d["state"] == "failed":
    if d.get("failCode") == "CONTENT_MODERATION":
        # Not charged. The same input will be blocked again: ask the user to edit it.
        print("Blocked:", d["failMsg"])
    elif d.get("failCode") in ("UPSTREAM_BUSY", "TIMEOUT"):
        pass  # safe to retry the same request

Preguntas frecuentes

Am I charged when a request is blocked by content safety?

No. The credit reserved when the task was created is released in full when it fails, whether the prompt, a reference image or the generated result was blocked.

Why does the same prompt sometimes pass and sometimes get blocked?

When the check runs on the generated result, every attempt produces a different picture, so one may pass and the next may not. Providers also adjust their rules over time. If a prompt is filtered twice in a row, rewrite it rather than retrying.

Can content moderation be turned off?

No. The checks are part of the model provider's service. If your legitimate content keeps being refused by a strict model, try a model with more relaxed moderation, such as the Spicy models. Content involving minors is refused everywhere.

My reference photo of a real person was rejected. What now?

That model does not accept real, identifiable people, and the same photo will fail again. Use an illustrated or synthetic face, or send the job to Seedance 2.0 or Seedance 2.0 Mini, which accept real-person reference photos and videos.

How can my code tell a moderation block from other errors?

Check failCode. A moderation block is always "CONTENT_MODERATION", and it is marked not retryable; temporary problems use other codes such as UPSTREAM_BUSY or TIMEOUT.

Relacionado

Aparece en
APIMODELS on Product HuntAPIMODELS featured on ToolifyAPIMODELS featured on There's An AI For That