Per-customer spend caps on Sume: what Sume caps, what you log
A Sume key belongs to a workspace, not your end customer. Cap each run with generation_spend_cap_usd and keep a per-customer ledger yourself.

Sume cannot know who your end customers are: a key resolves a workspace and an owner, and nothing in the request carries your tenant. A per-customer budget therefore has two layers, a per-run cap that Sume enforces and a per-customer total that your code enforces from your own records.
The layer Sume enforces
On Format runs, generation_spend_cap_usd bounds what one run may spend; the docs treat a missing cap as a client bug, and a value of 0 or over 500 is rejected with 400 invalid_request. Balance is a second gate: when it cannot cover the estimate, a submit fails 402 insufficient_credits before provider work starts.
The layer you own
Record, per customer, the job or run id, the idempotency key and the cap you granted before you submit. Refuse the submit when granted caps would pass the customer's allowance. Where an endpoint takes caller metadata (Video 1.0 documents it as stored on the job and not sent to the provider), tag the job with your customer id to join later.
| Limit | Enforced by | Failure you see |
|---|---|---|
| Cost of one run | Sume, via generation_spend_cap_usd | Run stops at the cap |
| Workspace balance | Sume | 402 insufficient_credits |
| Customer allowance | Your code and database | Your own 4xx |
| Concurrency per workspace | Sume, by plan | queued, then 429 queue_full |
Reconcile from the ledger
GET /v1/usage lists ledger entries such as reservations, captures, refunds and top-ups. Compare those against your per-customer totals on a schedule; the difference is either a cap you granted but did not spend or a job you failed to record.
Sources
Related posts
More in Developers
- Perplexity Decisions API as a publish gate for Sume output
Check a finished Sume Format image with Perplexity's Decisions API before it ships: base64 data URL, one yes/no question, a threshold, and a human-review lane.
- Pocket TTS API: run it yourself or call a hosted TTS API
Kyutai's Pocket TTS installs with pip and serves from localhost. If you want a hosted API with job URLs instead, here is the Sume request and what changes.
- Prefect 3 task retries for a Sume job: same Idempotency-Key
Retry a Sume image job in Prefect 3 without paying twice: a tested flow with retry_condition_fn, delay list and an order-derived idempotency key.
- Pydantic model to Sume output_schema: extra forbid, no defaults
Turn a Pydantic v2 model into a valid Sume Format output_schema: extra=forbid, nullable instead of defaults, and the SumeMediaFile reference. Tested.
Written by Sume