What did one image job cost? Read the usage ledger by job_id

Get the exact wallet movement for one image job with GET /v1/usage and a job_id: reserved, captured or refunded, and the summary's debited figure.

4 min readSume
All posts

Call GET /v1/usage with job_id set to the job's id, and read summary.debited_usd: it is what the wallet deducted for that job. The usage docs say the summary folds every ledger row the job caused, and tell you never to sum the rows yourself, because a refunded row keeps its hold amount.

That one call answers a finance question that response bodies cannot: what was actually charged after a failure, a cancellation or a retry.

Where do I get the job id?

An image call that finishes inside 30 seconds returns 200 with usage.cost and no job envelope. When it returns 202, the id is at data.job.id. Use the envelope id for the ledger lookup, or send mode: "async" so every call gives you one.

What does the ledger show?

Rows move through three statuses, per the docs.

Usage ledger row statuses for generation jobs, read 2026-10-02.
StatusMeaningCounts as spend?
reservedEstimate held before the provider runsNo, a hold
capturedBillable usage taken after successYes
refundedHold released after failure or cancellationNo

What does the call look like?

Pass the job id and a small limit; limit only caps the rows listed, not the summary.

import os, requests

job_id = "job_01J_REPLACE_ME"
r = requests.get(
    "https://api.sume.com/v1/usage",
    headers={"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"},
    params={"job_id": job_id, "limit": 20},
    timeout=30,
)
r.raise_for_status()
summary = r.json().get("summary", {})
print("debited:", summary.get("debited_usd"))
print("refunded micros:", summary.get("refunded_usd_micros"))
print("final:", summary.get("final"))

How do I read the result?

Wait for final to be true before you quote a number, because open holds are not spend yet. For a failed image the docs say the generation is not billed, so expect a refunded row and no debit. Log the debited figure beside the job id.

Sources

Related posts

More in Pricing

All Pricing posts

Written by Sume