Check credit balance
GET /user/credits/info returns the authenticated team’s credit balance, a per-lot breakdown, active subscription details, and whether usage is allowed.
Use this endpoint to power billing widgets, usage dashboards, or pre-flight checks before running large jobs.
For API details see Get credit info.
Response
Each lot in
breakdown has a purchase_kind of Subscription, Top-up, Manual, Setup, or Pending.
Purchase a top-up
POST /user/purchase-topup charges a saved card on Stripe and buys credits in one step. There is no Checkout redirect or embedded payment UI.
Pass the credit amount in the request body:
Supported values: 10,000, 20,000, 80,000, and 100,000.
For API details see Purchase top-up.
Requirements
- The team must have a Stripe customer with at least one saved card.
- Only one purchase attempt is allowed every 60 seconds per team. If you hit the cooldown, the response is 429 with a
Retry-Afterheader.
Responses
200 — payment succeeded:Credits are issued by the Stripe webhook after payment confirmation, not directly from the HTTP response. Treat 200 as payment success; poll
GET /user/credits/info if you need to confirm the updated balance.Common errors
Automatic refills
To keep your balance from running out, check it on a schedule and buy a top-up when it drops below a threshold. This uses the two endpoints above and works anywhere you can run a script: a cron job, a CI step, a serverless function, or an AI agent before a large job.- Call
GET /user/credits/infoand readcredits. - If
creditsis below your threshold, callPOST /user/purchase-topupwith one of the supported amounts. - On 200 or 202, stop. Credits arrive once Stripe confirms the payment, so don’t buy again on the next check until the balance has updated.