Images

Image generation

Make pictures from a prompt with OpenAI’s Images API: Nano Banana and GPT Image, one call each.

POST/v1/images/generations
ModelIDSizes and pricesReference images
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
GPT Image 2.5 Flaregpt-image-2.5-flare$0.02 an imageup to 16
GPT Image 2.5 Sunburstgpt-image-2.5-sunburst$0.02 an imageup to 16
GPT Image 2gpt-image-2$0.02 an imageup to 16

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). 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.
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.

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

GPT Image costs the same at every size: 1024x1024, 1536x1024, 1024x1536, 2048x2048, 3840x2160, 2160x3840.

  • 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 image history, where you can download them again. Images returned as b64_json aren’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.