Images
Image generation
Make pictures from a prompt with OpenAI’s Images API: Nano Banana and GPT Image, one call each.
/v1/images/generationsMake an image
import osfrom openai import OpenAIclient = OpenAI(base_url="https://api.zurelay.com/v1", api_key=os.environ["ZURELAY_API_KEY"])result = client.images.generate( model="nano-banana-pro", prompt="A red fox curled up asleep in fresh snow at dawn, soft golden light, 85mm photo", size="2K", extra_body={ "aspect_ratio": "3:2" },)print(result.data[0].url){ "created": 1790870400, "data": [ { "url": "https://...signed link, valid for 24 hours..." } ]}Parameters
modelstringrequired- An image model ID.
promptstringrequired- What to make, up to 32,000 characters.
ninteger- How many images, 1 to 4. They’re made at once; you pay for the ones delivered.
sizestring- Nano Banana:
1K,2Kor4K(or pixels like2048x1152, read as the nearest resolution and shape). GPT Image: pixels, such as1024x1024or3840x2160. Leave it out for the default. aspect_ratiostring- Nano Banana:
1:1,2:3,3:2,3:4,4:3,4:5,5:4,9:16,16:9or21:9. response_formatstringurl(default): a link valid for 24 hours.b64_json: the image itself, base64-encoded.imagesarray- Reference images to edit or work from. See Image editing.
quality, background, output_formatstring- GPT Image only: see the GPT Image guide.
Sizes
Nano Banana is priced by resolution and makes exactly the size asked for: an image that comes back smaller is retried, never delivered. At 1K:
GPT Image costs the same at every size: 1024x1024, 1536x1024, 1024x1536, 2048x2048, 3840x2160, 2160x3840.
Links and history
- Links in
urlare signed and work for 24 hours. Download what you want to keep. - Images returned as
urlare also kept for 30 days in your dashboard’s image history, where you can download them again. Images returned asb64_jsonaren’t stored. - Prompts sent through the API aren’t stored with the images.
Timing
Most images arrive in 10 to 60 seconds, longer at 4K. If an attempt stalls, the request is retried on another path automatically, so give your client a timeout of 10 minutes.
When an image isn’t made
If the model declines a prompt (say, for its content policy), you get 400 image_not_generated with the model’s reason, and you’re not charged. With n above 1, you get the images that were made and pay only for those.
Questions, or something missing? Ask support in your dashboard or email support@zurelay.com.