Estimate a batch image cost from the Sume catalog in Python

Read a model's price from GET /v1/images/models/{id}/endpoints and multiply by n and count. A 14-line Python estimator, with the quality and size caveat.

5 min readSume
All posts

Read the price from the catalog and multiply: cost_usd x n x number of calls. The model's endpoints route, GET /v1/images/models/{id}/endpoints, returns pricing entries whose cost_usd is Sume's billable price, per the Image API docs. That gives you an estimate before you submit a 100-image batch, with no hard-coded price table to go stale.

Quality-tiered and token-billed models, such as Ideogram 4.5 and GPT Image 2.5, return more than one price line or depend on size, so pick the entry that matches your request.

What does the estimator look like?

It takes the first pricing line; for tiered models, filter it by quality.

import os, requests

H = {"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"}

def estimate(model, n, calls):
    url = f"https://api.sume.com/v1/images/models/{model}/endpoints"
    r = requests.get(url, headers=H, timeout=30)
    r.raise_for_status()
    price = r.json()["data"]["endpoints"][0]["pricing"][0]["cost_usd"]
    return float(price) * n * calls

print(estimate("qwen/qwen-image", 4, 25))

What can make the estimate wrong?

Size, quality and reference count all move price on some models. GPT Image 2.5 is token-billed, and its input tokens are estimates. Treat the figure as a budget, then compare it to usage.cost after the first wave. Prices here are list x 1.25 in dollars per image before whole-cent rounding; the catalog's billable formula reads "list x 1.25, ceil usd cents", so confirm the first charge in usage.cost and budget from the invoice, not from the sum.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume