Creating multiple images in a single API call with GPT-image-1

Hi all,

I’m new here and learning how to use OpenAI APIs. I’ve been working with the latest GPT-image-1 model in the generations endpoint for single image generation and it’s been working wonderfully.

However I just now switched to N=5 and I am struggling with formatting the body of my API call so that it returns 5 images. I want to define ‘characters’ that will show up consistently across all images and a stylistic standard upfront, and then define each image separately.

Has someone done something like this before and can provide guidance on how to write the body?

thank you!
Andrea

2 Likes

The “n”: parameter only performs the same input prompt again, and then uses the variations that come about from random sampling during AI generation of tokens to deliver different images.

You would need to make different API calls for each prompt variation.

Language generally isn’t enough to get the same character, such as four scenes of a cartoon each separately generated, even when completely described (although the AI model seems to have a smaller vocabulary of depictions, making the outputs closer than DALL-E 3 was).


I would recommend making character reference images to be used universally. Then using these as inputs to the edits endpoint. Send language about the purpose of each input image and how they should be employed to synthesize a new final product, and then have a separate changing language prompt section that has “setting/scenario” described.

Animator’s reference sheet, a new one from existing examples, by AI (with AI faults).

Quite literal replication then from a request for a four-panel color cartoon, but I didn’t type up much of how to depict each, except for which have speech balloons and the colors.

Thank you so much! This makes sense. Can I ask one more thing? Have you ever worked with Bubble? I have tried to use the edits endpoint and I’m struggling to upload the image as a file - even when the image (say, the character visual reference) is saved as a file in Bubble’s data base.

I code instead of nocode.

The upload in the edits endpoint request, along with the text parameters, are sent as POST multipart/form-data (not JSON), where the files have filenames.

Here’s a post showing how to make such a request, to a different API.

You’ll likely want a dynamic number of end user input file possibilities for the AI vision in an app, minimum 1.