Python: find Sume image models that list a ratio like 8:1 or 4:5

A 15-line Python script reads GET /v1/images/models and prints every Sume image model that lists a given aspect ratio, so you stop guessing before a 400.

3 min readSume
All posts

To find which Sume image models accept an aspect ratio, read GET /v1/images/models and filter on supported_parameters.aspect_ratio.values. The script below does it in one call, so you can check 8:1, 4:5 or 9:19.5 before you send a generation and hit a 400 unsupported_parameter.

The catalog is the allowlist. If a model does not list a value, Sume rejects the field instead of quietly dropping it. That is why asking the catalog first is cheaper than finding out on a paid request.

The script

It needs SUME_API_KEY in your environment and the requests package. It makes one read call, no generation, so it costs nothing.

import os
import sys

import requests

API = "https://api.sume.com/v1/images/models"


def models_with_ratio(ratio):
    key = os.environ["SUME_API_KEY"]
    resp = requests.get(API, headers={"Authorization": f"Bearer {key}"}, timeout=30)
    resp.raise_for_status()
    hits = []
    for model in resp.json()["data"]:
        ratios = model["supported_parameters"].get("aspect_ratio", {}).get("values", [])
        if ratio in ratios:
            hits.append(model["id"])
    return hits


if __name__ == "__main__":
    wanted = sys.argv[1] if len(sys.argv) > 1 else "8:1"
    print(wanted, "->", models_with_ratio(wanted))

What you should see

The answers below follow the repository catalog on 2026-10-08. Run the script to see the live list, because a row can be hidden when its platform provider is not configured.

Ratio to rows that list it (read 2026-10-08)
RatioRows that list it
8:1 and 1:8google/nano-banana-2.1 only
9:19.5 and 9:20x-ai/grok-image only
4:5Nano Banana 2.1 and Pro, GPT Image 2 and 2.5, Seedream, FLUX.2, Qwen, Recraft, Ideogram
10:16 and 16:10Ideogram V3 and 4.5 only

Why a catalog check beats trial and error

A wrong ratio fails as a 400 unsupported_parameter, and the error names the field, but a pipeline that learns this one job at a time wastes retries and operator attention. The catalog check turns it into a planning step: before a campaign starts, run the script for each ratio in the brief and write the answer into the brief itself.

The same pattern works for any descriptor. Swap aspect_ratio for resolution or quality and the loop reads the values list; for n and input_references the descriptor is a range with min and max, so compare numbers instead of membership.

Use it in a pipeline

  • Run it in CI against a list of ratios your design team asked for. Fail the build when the answer is empty.
  • Cache the result for a few minutes, not forever; the catalog can change.
  • For a model that has a ratio, still read n and resolution descriptors before you batch.

Handling the empty result

An empty list is an answer, not an error. It means no live row lists that ratio today, so the next step is to choose a close one and crop. For example, if the brief asks for 3:1 and nothing lists it, run the script for 16:9 and 2:1, pick the nearest, and note the crop in the brief. Print the ratio you asked for in the output so a log line is enough to explain the choice later.

What Sume does not do

The script cannot tell you price. For that, read the endpoints route of each hit. Sume also cannot make a model take a ratio it does not list: there is no cropping fallback inside the API, so generate at a nearby listed ratio and crop on your side.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume