# Billing

An account has one plan and a prepaid wallet. The plan's fee comes back as machine time, and the wallet pays for time past the plan and for extra starts. Amounts in the API are strings with six decimals, as in `"0.036000"`.

## The plan

The plan costs $20 a month and includes 555 hours of `default` machine time, or the same value in other sizes. The fee is taken from the wallet at the start of each period. Included time not used by the end of the period is lost.

## Account states

`thz whoami --json` shows the account's `state`.

- `active`: machines can start.
- `payment_due`: the plan has not started, because the wallet does not hold $20 yet. A start fails with `payment_due` and exit code 5. The error message tells the owner how to pay. Only the owner can pay. Ask them to, and try again after they have.
- `suspended`: machines cannot start. The error message gives the reason.

## Machine time

Machine time is billed by the second, from when the machine is ready to when it begins to stop. `thz usage --json` shows the period's time and cost per machine, and the included time used and left. A machine stops with the reason `wallet_empty` when the wallet cannot pay its next minute.

## Starts

Creating a machine and resuming one each count as one start. A refused start is not counted. The plan includes 15 starts in any minute, 75 in any hour and 250 in any 24 hours. A start past one of those numbers is an extra start, paid from the wallet:

| How far past the window's number | Price |
|---|---|
| up to 1.5 times | $0.03 |
| up to 2 times | $0.05 |
| up to 6 times | $0.07 |

Past 6 times, a start fails with `start_limit_reached`, and `retryAfterSeconds` says when a start is free again. `thz limits --json` shows the starts used in each window and what the next start costs. `thz limits --extra-starts off` refuses extra starts instead of paying for them.

## The wallet

`thz wallet --json` shows the balance and every movement, newest first. The owner tops the wallet up. An agent cannot.
