Error in Image Generation API - Rejection by Safety System

Hello, I’m experiencing an issue while using the Image Generation API. Whenever I send requests with the following prompts(names of recipes in Portuguese) I receive the response "Your request was rejected as a result of our safety system. ":

  • “Pudim de Arroz”
  • “Lulas salteadas”
  • “Pudim de Coco”

Here’s an example of one of the requests made using cURL:

curl --location 'https://api.openai.com/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $ACCOUNT_KEY' \
--data '{
    "prompt": "Pudim de Arroz",
    "n": 1,
    "size": "512x512"
  }'

And Response:

 HTTP/2 400 
date: Sat, 27 May 2023 22:07:22 GMT
content-type: application/json
content-length: 173
access-control-allow-origin: *
openai-version: 2020-10-01
x-request-id: 7f035dac6bd34715925c254fdb7b70de
openai-processing-ms: 466
strict-transport-security: max-age=15724800; includeSubDomains
cf-cache-status: DYNAMIC
server: cloudflare
cf-ray: 7ce191ff19c451d7-GRU
alt-svc: h3=":443"; ma=86400

{
  "error": {
    "code": null,
    "message": "Your request was rejected as a result of our safety system. ",
    "param": null,
    "type": "invalid_request_error"
  }
}

I’ve also made a moderation API call to ensure the content is appropriate.
Here’s the request and its response:
Request:

curl --location 'https://api.openai.com/v1/moderations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $ACCOUNT_API_KEY' \
--data '{"input": "Pudim de Arroz"}'

Response:

HTTP/2 200 
date: Sat, 27 May 2023 22:22:22 GMT
content-type: application/json
content-length: 464
openai-version: 2020-10-01
x-request-id: c9dceb70d089bd4fce1cff6b63defcbf
openai-processing-ms: 302
strict-transport-security: max-age=15724800; includeSubDomains
cf-cache-status: DYNAMIC
server: cloudflare
cf-ray: 7ce1a7fd2d0c00e9-GRU
alt-svc: h3=":443"; ma=86400

{
  "id": "modr-7Kwakq3WTQOUD3UIxwuhkWDRRi3Wj",
  "model": "text-moderation-004",
  "results": [
    {
      "flagged": false,
      "categories": {
        "sexual": false,
        "hate": false,
        "violence": false,
        "self-harm": false,
        "sexual/minors": false,
        "hate/threatening": false,
        "violence/graphic": false
      },
      "category_scores": {
        "sexual": 0.000010728935,
        "hate": 0.00013834653,
        "violence": 0.0000013368676,
        "self-harm": 1.8360632e-8,
        "sexual/minors": 0.0000015715747,
        "hate/threatening": 1.3715776e-8,
        "violence/graphic": 1.3062949e-7
      }
    }
  ]
}

If you need any additional information, please let me know.
Thanks.

1 Like

Lots of really good questions here that don’t seem to be answered.

1 Like

AFAIK, DALLE has it’s own separate moderation and doesn’t necessarily use the same moderation endpoint… What do the phrases translate to in English? Is there any English in the prompt? As it’s primarily trained on English, the foreign language prompt might be triggering it. During the original DALLE2 beta, we were told not to use foreign language prompts.

One must consider that an image creator can generate unexpected and policy-violating content even if the prompt language sails right through a typical moderations engine looking for violence/hate and other categories. So detections have necessarily been increased. The “rice pudding” Portuguese sails right through now, though.

An image creator and moderator can also be prompt engineered. Below, my language with only one conclusion to be reached would likely have gotten me artful nudes (although the AI doesn’t have much imagery trained in that area), but a second level of image filtering with computer vision looks at what was produced and blocks all four iterations:

image