Grok Imagine cost calculator in Python: ceil to the cent per job

A Python function that prices Grok Imagine clips on Sume at $0.0125 a second, ceiled to the cent per job, so 50 clips of 5 s is $3.50, not $3.13.

5 min readSume
All posts

Fifty 5-second Grok Imagine clips on Sume cost $3.50, not the $3.13 you get from multiplying seconds by the rate. Sume bills the provider list times 1.25, and the repo's Grok estimator records a list of $0.01 per output second, so the rate is $0.0125 a second; each job's price is then ceiled to the cent. A 5-second job is $0.0625, which bills as $0.07, and 50 of them are $3.50.

The function

The function below does the same arithmetic with Decimal, so there are no float errors. Pass the seconds for each clip and it returns the unrounded and the billed total. It uses the 4 to 15 second range that grok-imagine-video-1.5 accepts and raises for anything outside it.

from decimal import Decimal, ROUND_CEILING

RATE = Decimal("0.0125")  # USD per output second, grok-imagine-video-1.5

def price(seconds: list[int]) -> tuple[Decimal, Decimal]:
    raw = billed = Decimal(0)
    for s in seconds:
        if not 4 <= s <= 15:
            raise ValueError(f"{s}s is outside 4-15s")
        job = RATE * s
        raw += job
        billed += job.quantize(Decimal("0.01"), rounding=ROUND_CEILING)
    return raw, billed

for plan in ([5] * 50, [4] * 50, [8] * 50, [15] * 50):
    raw, billed = price(plan)
    print(plan[0], "s x", len(plan), "-> raw", raw, "billed", billed)

What it prints

The output is below. Four and eight seconds land on a whole cent, so the billed total equals the raw one. Five seconds loses three-quarters of a cent per clip. Check the live catalog price before you budget with this, because the list price can change and the rate in the script is a constant I read from the repo on 2026-10-13.

50 Grok Imagine clips on Sume (read 2026-10-13)
Clip lengthRaw totalBilled total
4 s$2.50$2.50
5 s$3.125$3.50
8 s$5.00$5.00
15 s$9.375$9.50

Limits

Two limits apply. The estimate is for output seconds only, and a job whose wallet is short is refused with 402 insufficient_credits before it starts. For the comparison with xAI's own prices, the xAI models page lists Grok Imagine Video 1.5 at $0.08 a second; that is xAI's billing, not Sume's.

Sources

Related posts

More in Pricing

All Pricing posts

Written by Sume