GPT Image Action Problems

The image action code is set to n=1 but the action returns two images, however, they are identical. Tried modifying the trigger and also added a model instruction but it doesn’t modify the behaviour of the action. From what I can see in the API, both images are identical but they appear to have been stored by PA twice and both are presented to the user in the front end as if the are from a set of multiple images using separate/different URLS.

Edit: Not sure what is happening now. I can modify my PR to pull just the last generated image. Its not ideal but it is working. BUT all of a sudden, my images do not appear to be coming from GPT-Image anymore, they appear to be coming from pollinations.ai! They all appear with a watermark and the images are not accurate to the user request… Any ideas? Suggestions?

Fixed it with this code, commented out the shutfil.copy step; also I added a 30 second timeout to help make it more stable:

response = requests.post(api_url, headers=headers, json=data, timeout=30) # <- how long to wait (in seconds) before aborting the HTTP request


if response.status_code == 200:
    image_base64 = response.json()["data"][0]["b64_json"]
    image_bytes = base64.b64decode(image_base64)

    output_file = "gpt-image.png"

    with open(output_file, "wb") as f:
        f.write(image_bytes)

    #shutil.copy(output_file, "generated_image.png")
else:
    print("Failed to generate image")
1 Like

Cheers Gil - seemed to do the trick…