Images
Image generation
Make pictures from a prompt with OpenAI’s Images API: Nano Banana, GPT Image, Grok Imagine and FLUX 3, 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); Nano Banana 2 Lite makes 1K only. Grok Imagine:1Kor2K. FLUX 3:1K,2Kor4K. 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. Grok Imagine: the same but4:5and5:4. FLUX 3: 15 shapes, see the FLUX 3 guide. 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.
modelsarray- Smart routing for this request: alternatives to try, in order, if the model is down. See Smart routing.
callback_urlstring- An https URL to send the images to when they’re ready. With it, the request answers at once (
202, with an id) instead of waiting. See Callbacks.
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:
Grok Imagine makes about one megapixel at 1K and four at 2K, at sizes of its own (1280 × 720 for 16:9 at 1K); one in another shape or resolution is retried, never delivered. See the Grok Imagine Image guide.
FLUX 3 makes about one megapixel at 1K, four at 2K and sixteen at 4K, in 15 shapes from 21:9 to 9:21; one smaller than asked, or in another shape, is retried, never delivered. See the FLUX 3 guide.
GPT Image 2 costs the same at every size: 1024x1024, 1536x1024, 1024x1536, 2048x2048, 3840x2160, 2160x3840. GPT Image 2.6 and 2.5, Flare and Sunburst, are priced by size: up to 1024 × 1024 is 1K, up to 2560 × 1440 is 2K, and anything larger is 4K. Asked for no size, or auto, they make 1024 × 1024.
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 Library, where you can download them, delete them, or use them as reference images. Images returned asb64_jsonaren’t stored. - Each stored image keeps the prompt that made it, shown beside it in the dashboard, and both are deleted after the same 30 days.
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. Or don’t wait at all: add a callback_url and the images come to your server when they’re ready (see Callbacks).
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 our support team and we’ll answer by email, usually within a minute.