Contract test for 1:4, 4:1, 1:8, 8:1: pytest on /v1/images/models
A 12-line pytest that fails CI if Sume stops listing the Nano Banana 2.1 strip ratios. It reads GET /v1/images/models, so it generates nothing.

If your product ships banners at 8:1, a catalog change that drops the ratio would show up as 400 unsupported_parameter in production. A pytest against GET /v1/images/models catches it in CI before that: the endpoint lists each model's aspect_ratio values, and the test asserts that 1:4, 4:1, 1:8 and 8:1 are still in the google/nano-banana-2.1 row. It generates no image.
The test
Sume documents supported_parameters as capability descriptors, and the aspect_ratio descriptor is an enum with a values list.
import os, requests
NEED = {"1:4", "4:1", "1:8", "8:1"}
def test_banana_lists_strip_ratios():
r = requests.get(
"https://api.sume.com/v1/images/models",
headers={"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"},
timeout=30,
)
r.raise_for_status()
row = next(m for m in r.json()["data"] if m["id"] == "google/nano-banana-2.1")
listed = set(row["supported_parameters"]["aspect_ratio"]["values"])
assert NEED <= listed, f"missing: {NEED - listed}"What the check pins
| Ratio | Meaning | Listed on Nano Banana 2.1 in the repo catalog |
|---|---|---|
| 1:4 | Tall strip | Yes |
| 4:1 | Wide strip | Yes |
| 1:8 | Very tall strip | Yes |
| 8:1 | Very wide strip | Yes |
Gotchas
- Use a key with access to the Image API; read-only CI can use a separate key.
next(...)raisesStopIterationif the model row disappears. That is a failure you want, but wrap it with a clearer message if you prefer.- The test proves the catalog; it does not prove an image renders as you expect.
Sources
Related posts
More in Developers
- Video Router body to /v1/videos: frame_images, input_references
Map Video Router image_url, end_image_url and reference_image_urls to /v1/videos frame_images and input_references, with a Node converter.
- Count queued and processing jobs with GET /v1/jobs before a wave
Page GET /v1/jobs with status=queued and status=processing, subtract from concurrency_limit, and submit only that many Seedance 2.5 or Omni clips.
- createSumeClient sends x-api-key only: an extra header gives 401
The Sume API accepts Bearer or x-api-key but rejects both at once with 401. A fetch wrapper for createSumeClient that drops the extra header, tested offline.
- curl -w http_code: branch a Sume video submit in bash on 202, 402, 429
A bash submit that saves the body, reads the HTTP code with curl -w and branches on 202, 402, 429 and 5xx. Three Wan 3.0 payloads cost $1.875, $3.75 and $7.50.
Written by Sume