> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roughy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Credit ledger

> How Roughy bills credits — a flat, per-source-minute charge settled once your asset is processed.

## One charge, per asset

Roughy's pricing is deliberately simple: **1 credit per started minute of
source media, rounded up.** A 10-minute podcast costs 10 credits; a
90-second clip costs 2. The charge settles **after** the asset is
processed — so a file that can't be processed is never charged.

Everything downstream is **free**: cuts, re-cuts with a different script,
renders, re-renders at another resolution, format exports. You pay for
the source asset once and operate on it as much as you like — the price is
predictable from the file's duration alone.

A positive credit balance is required to **start** an upload:
`POST /v1/assets` rejects a zero-or-below balance with `402`
(`insufficient_credits`) before the upload begins. The exact,
duration-based charge settles later, after processing.

## Pending payment

If your balance doesn't cover the charge once processing finishes, the
asset doesn't fail — it lands in `pending_payment`. The bytes are kept,
and the asset **activates automatically** (oldest first) on your next
top-up, transitioning to `ready` and firing `asset.ready`. Unredeemed
`pending_payment` assets are purged after 30 days.

## Ledger entry types

The ledger is append-only; balance is the sum of every entry's `delta`.

| Entry type      | When it's written                                                                           |
| --------------- | ------------------------------------------------------------------------------------------- |
| `consume_asset` | The per-asset charge, settled once the asset finishes processing (negative). One per asset. |
| `topup`         | Stripe checkout / portal credits (positive).                                                |
| `refund`        | Operator refund (positive).                                                                 |
| `adjustment`    | Manual correction (either sign).                                                            |
| `expiry`        | Time-based expiry of stale credits (negative).                                              |

## Reading the ledger

* `GET /v1/credits/balance` — your current balance:

  ```json theme={null}
  { "balance": 240 }
  ```

* `GET /v1/credits/history` — paginated ledger, newest first (`limit` +
  `offset`). Each entry carries `id`, `type`, `delta`, `asset_id` (for
  `consume_asset`), `grant_id` (grant-issued topups / expiry),
  `stripe_invoice_id` (billing topups), and `created_at`.

## Topping up

Credit purchases go through Stripe — checkout sessions and
customer-portal links are exposed via the billing endpoints in the
[API Reference](/api-reference). Successful payments land as `topup`
entries and immediately trigger recovery of any `pending_payment`
assets.

## Related concepts

* [Asset](/concepts/asset) — the unit that's charged, and the `pending_payment` lifecycle.
