AI Image Aspect Ratio API — 1:1, 16:9, and Portrait via GenRelay (2026)

Sep 8, 2026·7 min read

You're building a content pipeline that feeds multiple surfaces: a 1:1 square for Instagram feed posts, a 16:9 landscape for YouTube thumbnails, and a 9:16 portrait for Stories and Reels — all generated from the same product description. If your image API doesn't support configurable aspect ratios, you end up cropping distorted results or making separate API calls and hoping the composition cooperates.

The GenRelay image API exposes explicit aspect ratio and size controls for all three models: Nano Banana Pro, Nano Banana 2, and GPT-image-2. This guide covers the exact parameter syntax, output dimensions, and a batching pattern to generate all formats in parallel.

What aspect ratio parameters does the GenRelay image API support?

Each model exposes dimension control differently — aspect_ratio as a ratio string vs size as pixel dimensions — but the concepts map across all three.

Model Param name Format Supported values
Nano Banana Pro aspect_ratio string ratio 1:1, 16:9, 9:16, 4:3, 3:4
Nano Banana 2 aspect_ratio string ratio 1:1, 16:9, 9:16, 4:3, 3:4
GPT-image-2 size pixel string 1024x1024, 1536x1024, 1024x1536

All three models return a URL to the completed image. The aspect_ratio or size parameter controls the canvas dimensions baked into generation — it is not a post-processing crop. The model fills the specified canvas compositionally.

How do I set aspect ratio for Nano Banana Pro?

Pass aspect_ratio in the request body alongside the resolution tier. As of September 2026, Nano Banana Pro supports five ratios and three resolution tiers.

import requests

resp = requests.post(
    "https://genrelay.ai/v1/images/generations",
    headers={"Authorization": "Bearer YOUR_KEY"},
    json={
        "model": "nano-banana-pro",
        "prompt": "Minimalist product shot of a white ceramic coffee mug on a grey studio background",
        "aspect_ratio": "16:9",
        "resolution": "2k",   # "1k" | "2k" | "4k"
        "n": 1
    }
)
print(resp.json()["data"][0]["url"])

Pricing at 2K resolution is $0.030 per image regardless of aspect ratio. At 4K it rises to $0.042. Changing the ratio does not affect the per-image price — you pay for the resolution tier only.

How do I control image dimensions with GPT-image-2?

GPT-image-2 uses a size parameter with pixel dimensions instead of a ratio string. Three sizes are available:

  • "1024x1024" — 1:1 square
  • "1536x1024" — approximately 3:2 landscape (suitable for 16:9 thumbnail crops)
  • "1024x1536" — approximately 2:3 portrait (suitable for 9:16 Stories crops)
import requests

sizes = {
    "square":    "1024x1024",
    "landscape": "1536x1024",
    "portrait":  "1024x1536",
}

results = {}
for label, size in sizes.items():
    resp = requests.post(
        "https://genrelay.ai/v1/images/generations",
        headers={"Authorization": "Bearer YOUR_KEY"},
        json={
            "model": "gpt-image-2",
            "prompt": "Studio product photo of a blue running shoe, white background",
            "size": size,
            "n": 1
        }
    )
    results[label] = resp.json()["data"][0]["url"]

for label, url in results.items():
    print(f"{label}: {url}")

GPT-image-2 is priced at $0.014 per image across all three sizes. There are no resolution tiers — one flat price regardless of whether you request square, landscape, or portrait output.

How do I set aspect ratio for Nano Banana 2?

Nano Banana 2 uses the same aspect_ratio string format as Nano Banana Pro, with the same five supported ratios. Its resolution range is narrower — 1K or 4K only, with no 2K tier.

resp = requests.post(
    "https://genrelay.ai/v1/images/generations",
    headers={"Authorization": "Bearer YOUR_KEY"},
    json={
        "model": "nano-banana-2",
        "prompt": "Flat lay of skincare products arranged on marble surface, natural lighting",
        "aspect_ratio": "9:16",   # portrait for mobile / Stories
        "resolution": "1k",
        "n": 1
    }
)
print(resp.json()["data"][0]["url"])

Pricing: $0.020 per image at 1K, $0.036 at 4K. Nano Banana 2 at 1K is the most cost-efficient option when you need high-volume portrait or landscape outputs and do not require the instruction-following depth of Nano Banana Pro.

How do I generate multiple aspect ratios in parallel?

For multi-surface pipelines, fan out calls concurrently rather than looping sequentially. A sequential loop for three formats takes 3× the generation time; parallel calls complete in roughly the time of the slowest single call.

import requests
import concurrent.futures

API_KEY = "YOUR_KEY"
BASE_URL = "https://genrelay.ai/v1/images/generations"

def generate_image(aspect_ratio: str, label: str) -> dict:
    resp = requests.post(
        BASE_URL,
        headers={"Authorization": f"Bearer {API_KEY}"},
        json={
            "model": "nano-banana-pro",
            "prompt": (
                "Hero shot of a leather wallet on dark wood, "
                "dramatic lighting, product photography"
            ),
            "aspect_ratio": aspect_ratio,
            "resolution": "2k",
            "n": 1
        },
        timeout=60
    )
    resp.raise_for_status()
    return {"label": label, "url": resp.json()["data"][0]["url"]}

formats = [
    ("1:1",  "instagram_feed"),
    ("16:9", "youtube_thumbnail"),
    ("9:16", "stories_reels"),
]

with concurrent.futures.ThreadPoolExecutor(max_workers=3) as executor:
    futures = {
        executor.submit(generate_image, ratio, label): label
        for ratio, label in formats
    }
    for future in concurrent.futures.as_completed(futures):
        result = future.result()
        print(f"{result['label']}: {result['url']}")

This generates three formats for a single product in roughly the time of one sequential call. At $0.030 per 2K Nano Banana Pro image, all three formats together cost $0.09.

What does choosing an aspect ratio cost across models?

Aspect ratio itself is free to change — the cost driver is the resolution tier or model choice. Here's the full matrix:

Model Resolution Price/image Aspect ratio options
Nano Banana Pro 1K $0.030 1:1, 16:9, 9:16, 4:3, 3:4
Nano Banana Pro 2K $0.030 Same (no price increase vs 1K)
Nano Banana Pro 4K $0.042 Same
Nano Banana 2 1K $0.020 1:1, 16:9, 9:16, 4:3, 3:4
Nano Banana 2 4K $0.036 Same (no 2K tier)
GPT-image-2 $0.014 1024×1024, 1536×1024, 1024×1536

For a batch of 100 images (mixed landscape and portrait):

  • GPT-image-2: 100 × $0.014 = $1.40
  • Nano Banana 2 at 1K: 100 × $0.020 = $2.00
  • Nano Banana Pro at 2K: 100 × $0.030 = $3.00

For a full workload breakdown with more scenarios, see the AI image API pricing comparison.

FAQ

Can I request an exact pixel size like 800×1200?
Nano Banana Pro and Nano Banana 2 accept ratio strings, not pixel dimensions — you choose the resolution tier and the model handles the exact pixel count. GPT-image-2 gives you three fixed pixel sizes. Neither model currently supports fully arbitrary pixel dimensions.

Does changing the aspect ratio degrade generation quality?
No. Models are trained to handle all supported ratios compositionally. A 9:16 request fills a native vertical canvas rather than cropping a square output, so composition, framing, and detail are all maintained.

What aspect ratio is best for e-commerce product shots?
1:1 squares are the safest cross-platform default. Use 16:9 for hero banners and YouTube thumbnails. Use 9:16 for mobile-first campaigns — TikTok, Instagram Stories, YouTube Shorts.

Can I get a 2.35:1 cinema widescreen ratio?
Not via the current supported strings. Nano Banana models support 1:1, 16:9, 9:16, 4:3, and 3:4. GPT-image-2 maxes out at 1536×1024 (~3:2). Wider cinematic ratios are not currently available.

How many images can I generate in a single API call?
Set n up to the per-model limit. Nano Banana Pro, Nano Banana 2, and GPT-image-2 each support n up to 4 per call. For larger batches, see Batch image generation via API.


As of September 2026, all three image models on GenRelay support dimension control via aspect_ratio or size parameters at no added cost per ratio. Browse the Nano Banana model page and the GPT-image-2 page for the full parameter reference.

Related posts

Join our DiscordAI Image Aspect Ratio API — 1:1, 16:9, and Portrait via GenRelay (2026) — GenRelay