Skip to content
DUETA
Docs

Billing & credit

Check the balance, read usage, top up, and arm auto-recharge.

On this page
You need
  • An API key. Credit is in US dollars; the price is $0.50 per minute of the longest input, prorated per second.

Check the balance

GET/v1/credits

The balance is the sum of an append-only ledger. A job writes a negative hold when it is accepted; on success the hold is released and a job charge of the same amount is written; on failure or cancel only the release is written. The last 50 rows come with the balance.

json
{
  "balance_usd": 14.9,
  "ledger": [
    { "id": "9c2f...", "delta_usd": -5.1, "reason": "job",          "job_id": "0f9c...", "job_status": "succeeded", "created_at": "2026-08-28T09:34:02Z" },
    { "id": "7b81...", "delta_usd":  5.1, "reason": "hold_release", "job_id": "0f9c...", "job_status": "succeeded", "created_at": "2026-08-28T09:34:02Z" },
    { "id": "41ac...", "delta_usd": -5.1, "reason": "hold",         "job_id": "0f9c...", "job_status": "succeeded", "created_at": "2026-08-28T09:21:44Z" },
    { "id": "0a5e...", "delta_usd": 20.0, "reason": "signup_bonus", "job_id": null,      "job_status": null,        "created_at": "2026-08-27T11:03:00Z" }
  ]
}
reasonMeaning
signup_bonusThe $20 grant a new account gets.
holdReserved for a job at submission. Negative.
hold_releaseThe reservation given back. job_status says whether it succeeded, failed, or was canceled.
jobThe charge for a succeeded job: exactly the quote.
purchaseA paid top-up. Accounts with one queue ahead of free accounts.
adjustmentA manual credit by support.
bash
curl -H "Authorization: Bearer $DUETA_API_KEY" https://dueta.ai/v1/credits

Read usage

GET/v1/usage?from=YYYY-MM-DD&to=YYYY-MM-DD

Billed seconds and dollars per UTC day, aggregated from succeeded jobs by the day they finished. Both bounds are optional and inclusive.

json
{
  "days": [
    { "date": "2026-08-04", "billed_seconds": 210.3, "billed_usd": 1.75 },
    { "date": "2026-08-09", "billed_seconds": 140.0, "billed_usd": 1.16 }
  ],
  "total_billed_seconds": 350.3,
  "total_billed_usd": 2.91
}
bash
curl -H "Authorization: Bearer $DUETA_API_KEY" "https://dueta.ai/v1/usage?from=2026-08-01&to=2026-08-31"

Top up

GET/v1/billing/topup
POST/v1/billing/checkout
GET/v1/billing/orders/{id}

Read the bounds, start an order for a whole-dollar amount from $5 to $500, open the provider's payment window in a browser with what checkout returns, then poll the order. Credit is added when the order is paid. The price is always in dollars; a Korean card is charged the shown won amount instead.

FieldTypeMeaning
amount_usdintWhole dollars, 5 to 500.
region, currencystringOptional routing hints. Normally omitted; the server routes by card.
order_idstringPoll GET /v1/billing/orders/{id} for pending, paid, failed, refunded, expired.
script_url, entry_point, payloadstring, string, objectLoad the script, call the entry point with the payload. Browser only.
charge_display, credit_usdstring, floatWhat the card is charged, and the credit it buys.
bash
# 1. The bounds, presets and rate. Public.
curl https://dueta.ai/v1/billing/topup
# -> {"min_usd": 5, "max_usd": 500, "presets_usd": [10, 20, 50, 100],
#     "rate_usd_per_minute": 0.5, "charge_currency": "USD", "provider": "payple_global", ...}

# 2. Start an order for a whole-dollar amount in range.
curl -X POST https://dueta.ai/v1/billing/checkout \
  -H "Authorization: Bearer $DUETA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount_usd": 20}'
# -> {"order_id": "...", "provider": "...", "script_url": "...", "entry_point": "...",
#     "payload": {...open the provider's payment window with this...}, "credit_usd": 20.0}

# 3. Poll the order until it leaves "pending".
curl -H "Authorization: Bearer $DUETA_API_KEY" https://dueta.ai/v1/billing/orders/$ORDER_ID

Auto-recharge

GET/v1/billing/auto-recharge
PUT/v1/billing/auto-recharge

When the balance drops below threshold_usd, buy amount_usd more. The amount obeys the top-up bounds. The response says whether it can fire today: active is false with a reason while payments are not live or no billing method is on file.

bash
curl -X PUT https://dueta.ai/v1/billing/auto-recharge \
  -H "Authorization: Bearer $DUETA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled": true, "threshold_usd": 5, "amount_usd": 20}'
# -> {"enabled": true, "threshold_usd": 5, "amount_usd": 20,
#     "active": false, "reason": "payments_not_live", "detail": "...", ...}

Cases

503
Not available yet. Card payments are not switched on yet. Contact us and we will top up your account directly. /v1/billing/topup and /v1/billing/checkout answer 503 until then. It is a state, not an outage; do not retry on a timer.
400
The amount is not a whole number of dollars in range, or an auto-recharge threshold is out of bounds.
402
A job costs more than the balance. See Run a separation.
Expired order
An order left pending for 30 minutes is closed as expired. Start a new one.
Rounding
Money fields are floored to the cent on the way out, except ledger rows, which stay exact so they sum to the balance.
Never charged
Uploads, quotes, failed jobs, canceled jobs.