Alert when a Sume image model price changes: Python snapshot script

Compare the billed price of every Sume image model against a saved snapshot with two endpoints and a JSON file, and print only the rows that changed.

4 min readSume
All posts

Run GET /v1/images/models, fetch each model's endpoints record, and compare pricing[0].cost_usd with a JSON snapshot; the script below prints a line for every model whose billed price changed or that is new. It needs two endpoints and about 25 lines of Python.

The price is the amount charged to your wallet per image, with Sume's margin already applied, so an alert on this field is an alert on your own bill. Facts are from the Sume Image API docs (read 2026-10-03).

What the two endpoints return

Sume serves every model through a single sume endpoint in v1, so endpoints[0] is the only record. Rows with state-dependent prices (ChatGPT Image 2.5 by quality and size, Nano Banana by resolution, Ideogram 4.5 by quality) report the default-tier price, which is the figure the alert tracks.

Image catalog endpoints used by the script (read 2026-10-03)
EndpointGives youField used
GET /v1/images/modelsEvery catalog model with capabilitiesdata[].id
GET /v1/images/models/{model_id}/endpointsPer-endpoint capabilities and billed pricingendpoints[0].pricing[0].cost_usd

The script

Run it from a scheduler once a day. The first run writes the snapshot and reports every model as new; later runs report changes only.

import json
import os
import pathlib

import requests

BASE = "https://api.sume.com/v1/images/models"
H = {"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"}
SNAP = pathlib.Path("image-prices.json")


def get(url):
    r = requests.get(url, headers=H, timeout=30)
    r.raise_for_status()
    body = r.json()
    return body.get("data", body)


def main():
    old = json.loads(SNAP.read_text()) if SNAP.exists() else {}
    new = {}
    for m in get(BASE):
        ep = get(f"{BASE}/{m['id']}/endpoints")["endpoints"][0]
        new[m["id"]] = ep["pricing"][0]["cost_usd"]
        if old.get(m["id"]) != new[m["id"]]:
            print(m["id"], old.get(m["id"]), "->", new[m["id"]])
    SNAP.write_text(json.dumps(new, indent=1))


if __name__ == "__main__":
    main()

What to do with an alert

A change in a row you use is a budget input, not an incident: recompute the cost of your standing jobs (images per run times the new price) and decide whether to keep the model. Jobs already submitted are not repriced, since the amount is reserved on submit.

Keep the snapshot file in version control so a price move shows up in a diff next to the code that depends on it.

  • Alert on new ids as well: a new model row is a chance to cut cost on a standing job.
  • Log usage.cost from real responses and compare it with the snapshot weekly.
  • Do not hard-code prices in application code; read the snapshot.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume