Compare GET /v1/balance micros with a clip total, in integers

Balance comes as USD micros and cents. A 30 s Seedance 720p clip is 17,334,000 micros, 1,733 cents rounded down. Integer compare, plus the expiring-soon fields.

4 min readSume
All posts

GET /v1/balance returns the amount as available_amount_usd_micros and as rounded-down available_amount_usd_cents, and the cents value hides money: a 30 s Seedance 2.5 clip at 720p is $17.334, which is 17,334,000 micros but only 1,733 cents. Compare in micros, as integers, and a balance of $17.33 will not pass a check for $17.334.

Micros versus cents

One US dollar is 1,000,000 micros. Converting a clip total to micros makes the compare exact, and rounding down to cents is how the API reports the cents field.

The response is wrapped as data.balance and also carries state (funded or empty) and an expiration summary.

Clip totals in micros and in rounded-down cents (read 2026-10-09)
ClipTotalMicrosCents, rounded down
wan-3.0 720p, 30 s$3.753,750,000375
gemini-omni-flash-1.1 1080p, 10 s$1.8751,875,000187
seedance-2.5 720p, 30 s, 9:16$17.33417,334,0001,733
seedance-2.5 480p, 30 s, 9:16$8.060318,060,310806

The check

The expiring-soon fields tell you how much of the spendable balance leaves soon. They are informational: the credits are still spendable now.

import os
import requests

need = 17_334_000  # 30 s Seedance 2.5, 720p, 9:16
r = requests.get(
    "https://api.sume.com/v1/balance",
    headers={"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"},
    timeout=30,
)
r.raise_for_status()
bal = r.json()["data"]["balance"]
exp = bal["expiration"]
print("available:", bal["available_amount_usd_micros"])
print("expiring in", exp["expiring_soon_days"], "days:",
      exp["expiring_soon_amount_usd_micros"])
print("enough" if bal["available_amount_usd_micros"] >= need else "top up")

Gotchas

The cents field is rounded down and available_credits is a legacy rounded cent amount, so neither is safe for an exact compare. Amounts exclude expired, reserved, captured and depleted credits, so a job in flight already lowered the number.

A balance that passes the check can still hit 402 if another client spends first. Keep the handler.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume