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.

POST/v1/images/generations
ModelIDSizes and pricesReference images
Nano Banana 2.1nano-banana-2.11K $0.03 · 2K $0.04 · 4K $0.06up to 14
Nano Banana Pronano-banana-pro1K and 2K $0.035 · 4K $0.065up to 14
Nano Banana 2nano-banana-21K $0.025 · 2K $0.034 · 4K $0.058up to 14
Nano Banana 2 Litenano-banana-2-lite1K $0.016up to 14
GPT Image 2.6 Flaregpt-image-2.6-flare1K $0.008 · 2K $0.025 · 4K $0.035up to 16
GPT Image 2.6 Sunburstgpt-image-2.6-sunburst1K $0.008 · 2K $0.025 · 4K $0.035up to 16
GPT Image 2.5 Flaregpt-image-2.5-flare1K $0.008 · 2K $0.025 · 4K $0.035up to 16
GPT Image 2.5 Sunburstgpt-image-2.5-sunburst1K $0.008 · 2K $0.025 · 4K $0.035up to 16
GPT Image 2gpt-image-2$0.02 an imageup to 16
Grok Imagine Image 2.0grok-imagine-image-2.01K $0.045 · 2K $0.06up to 3
FLUX 3 Imageflux-3-image1K $0.04 · 2K $0.05 · 4K $0.09—

Make an image

import os
from openai import OpenAI
client = 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)
Response
{
"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, 2K or 4K (or pixels like 2048x1152, read as the nearest resolution and shape); Nano Banana 2 Lite makes 1K only. Grok Imagine: 1K or 2K. FLUX 3: 1K, 2K or 4K. GPT Image: pixels, such as 1024x1024 or 3840x2160. 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:9 or 21:9. Grok Imagine: the same but 4:5 and 5:4. FLUX 3: 15 shapes, see the FLUX 3 guide.
response_formatstring
url (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:

Aspect ratio1K2K4K
1:11024 × 10242048 × 20484096 × 4096
2:3848 × 12641696 × 25283392 × 5056
3:21264 × 8482528 × 16965056 × 3392
3:4896 × 12001792 × 24003584 × 4800
4:31200 × 8962400 × 17924800 × 3584
4:5928 × 11521856 × 23043712 × 4608
5:41152 × 9282304 × 18564608 × 3712
9:16768 × 13761536 × 27523072 × 5504
16:91376 × 7682752 × 15365504 × 3072
21:91584 × 6723168 × 13446336 × 2688

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 in url are signed and work for 24 hours. Download what you want to keep.
  • Images returned as url are 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 as b64_json aren’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.