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

# Usage and billing

> Know what your sandboxes cost while they run: spend today, this month and projected, what is awake right now, your plan's limits, credit and balance, and every charge in the ledger.

When you start sandboxes for every user and every task, your costs follow how much they are used. You will want to
**see those costs as they happen, not only when the invoice arrives**, for example on an internal dashboard, in a
daily message to your team, or as an alert when spending suddenly rises. The billing API gives you the numbers you
need.

| You want | Call |
| - | - |
| Spend today, this week, this month, projected | `GET /v1/billing/usage/summary` |
| What is awake right now, and costing money | `GET /v1/billing/current` |
| Plan, limits, credit, balance, storage | `GET /v1/billing/account` |
| Spend broken down for a period | `GET /v1/billing/usage` |
| Every charge and payment | `GET /v1/billing/ledger` |

To call it, use an API key with the `billing.read` scope. A key from the dashboard has it already.

## How much am I spending?

The summary gives you your spending so far today, this week and this month, and an estimate for the whole month:

```bash title="CLI" run theme={null}
fibre usage   # today, this month, projected, your plan and its limits
```

```typescript title="TypeScript" run theme={null}
import { Fibre } from "@fibre-dev/sdk";

const fibre = new Fibre();
const spend = await fibre.json<{ today: number; this_month: number; projected_month: number }>("GET", "/v1/billing/usage/summary");
console.log(`$${spend.today} today, $${spend.this_month} this month, ~$${spend.projected_month} by month end`);
```

```python title="Python" run theme={null}
from fibre import Fibre

fibre = Fibre()
spend = fibre.json("GET", "/v1/billing/usage/summary")
print(f"${spend['today']} today, ${spend['this_month']} this month, ~${spend['projected_month']} by month end")
```

```bash title="curl" run theme={null}
curl -sS "$FIBRE_API_URL/v1/billing/usage/summary" -H "Authorization: Bearer $FIBRE_API_KEY"
```

> [accordion] Response
>
> ```json title="response" expected theme={null}
> {
>   "today": "…",
>   "this_week": "…",
>   "this_month": "…",
>   "projected_month": "…"
> }
> ```

Amounts are in US dollars. `projected_month` estimates the whole month by assuming you keep spending at this
month's pace so far.

> [!TIP]
>
> **A daily spending message takes only a few lines of code.** Call this every morning and post `today` and
> `projected_month` to your team's chat. A sudden jump in `today` is usually the first sign of a sandbox that never
> goes to sleep.

## What is awake right now?

Only awake sandboxes cost money for compute. This call lists every sandbox that is awake, and being charged, right
now:

```typescript title="TypeScript" run theme={null}
const { sessions } = await fibre.json<{ sessions: any[] }>("GET", "/v1/billing/current");
console.log(`${sessions.length} awake`);
```

```python title="Python" run theme={null}
sessions = fibre.json("GET", "/v1/billing/current")["sessions"]
print(f"{len(sessions)} awake")
```

```bash title="curl" run theme={null}
curl -sS "$FIBRE_API_URL/v1/billing/current" -H "Authorization: Bearer $FIBRE_API_KEY"
```

> [accordion] Response
>
> ```json title="response" expected theme={null}
> {
>   "sessions": "…"
> }
> ```

If this list is long at a time when your users are not active, look for sandboxes with `idle_timeout_sec: 0`, or
for programs that keep them busy. See [what keeps a sandbox awake](https://docs.fibre.dev/sandboxes/sleep-and-wake.md#when-it-sleeps).

## My plan, credit and limits

The billing account shows your plan, how much credit and balance you have left, and how close you are to your
plan's limits today:

```bash title="CLI" run theme={null}
fibre usage --json | jq '.account | {plan, limits, storage}'
```

```typescript title="TypeScript" run theme={null}
const account = await fibre.json<any>("GET", "/v1/billing/account");
console.log(account.plan, account.limits, account.storage); // tier_20 { sandboxes: 100, … } { gb: …, included_gb: 20 }
```

```python title="Python" run theme={null}
account = fibre.json("GET", "/v1/billing/account")
print(account["plan"], account["limits"], account["storage"])  # tier_20 {'sandboxes': 100, …} {'gb': …, 'included_gb': 20}
```

```bash title="curl" run theme={null}
curl -sS "$FIBRE_API_URL/v1/billing/account" -H "Authorization: Bearer $FIBRE_API_KEY"
```

> [accordion] Response
>
> ```json title="response" expected theme={null}
> {
>   "plan": "…",
>   "status": "…",
>   "credit_usd": "…",
>   "wallet_usd": "…",
>   "available_usd": "…",
>   "auto_topup": "…",
>   "limits": {
>     "sandboxes": "…",
>     "wakes_per_day": "…",
>     "above_limits": "…"
>   },
>   "usage_today": {
>     "sandboxes": "…",
>     "awake": "…",
>     "wakes_today": "…",
>     "paid_wakes_today": "…"
>   },
>   "storage": {
>     "gb": "…",
>     "included_gb": 20
>   }
> }
> ```

Here is what each part of the answer means:

| Field | Means |
| - | - |
| `plan`, `status` | Your plan and whether it is `active`, `trialing` or `canceled` |
| `credit_usd` | This period's plan credit left |
| `wallet_usd` | Your prepaid balance, used once credit runs out |
| `available_usd` | What you can spend now: credit plus balance |
| `auto_topup` | Whether the balance refills itself, when (`threshold_usd`) and by how much (`amount_usd`) |
| `limits` | Sandboxes kept and starts and wakes per day on your plan, and the price above them |
| `usage_today` | Sandboxes kept and awake now, and starts and wakes today: how close you are to those limits |
| `storage` | Saved state and snapshots, against your included 20 GB |

## Breakdown and ledger

Two more calls give you the detail behind the totals:

* **`GET /v1/billing/usage`** adds up awake hours and cost for a period. It covers this month unless you pass
  `from` and `to`.
* **`GET /v1/billing/ledger`** lists every charge and payment, newest first. Each entry shows how much was paid
  from plan credit and how much from your balance.

```typescript title="TypeScript" run theme={null}
const usage = await fibre.json<any>("GET", "/v1/billing/usage");
console.log(usage.total, usage.period); // { hours: …, cost: … } { from: '2026-11-01…', to: '…' }

const { entries } = await fibre.json<{ entries: any[] }>("GET", "/v1/billing/ledger", { query: { limit: 5 } });
for (const e of entries) console.log(e.at, e.kind, e.amount_usd);
```

```python title="Python" run theme={null}
usage = fibre.json("GET", "/v1/billing/usage")
print(usage["total"], usage["period"])  # {'hours': …, 'cost': …} {'from': '2026-11-01…', 'to': '…'}

for e in fibre.json("GET", "/v1/billing/ledger", params={"limit": 5})["entries"]:
    print(e["at"], e["kind"], e["amount_usd"])
```

```bash title="curl" run theme={null}
curl -sS "$FIBRE_API_URL/v1/billing/ledger?limit=2" -H "Authorization: Bearer $FIBRE_API_KEY"
```

> [accordion] Response
>
> ```json title="response" expected theme={null}
> {
>   "entries": "…"
> }
> ```
>
> A single ledger entry looks like this:
>
> ```json title="entry" theme={null}
> {
>   "kind": "usage",
>   "ref": "c5cf6de5-0a48-4723-9e11-9dd49914dc9b:5",
>   "amount_usd": -0.000005,
>   "from_credit_usd": 0,
>   "from_wallet_usd": 0.000005,
>   "details": {
>     "session": "c5cf6de5-0a48-4723-9e11-9dd49914dc9b"
>   },
>   "at": "2026-11-21T01:33:18.000Z"
> }
> ```

Because awake time is counted by the second, a single entry can be a small fraction of a cent.

## Paying

You can change your plan, update your card, download invoices and add money in the dashboard, under **billing**.
If you would rather build these into your own app, the same actions are available in the API:

| Call | Does |
| - | - |
| `POST /v1/billing/checkout` | A checkout link to start or change a plan |
| `POST /v1/billing/portal` | A link to manage the card and download invoices |
| `POST /v1/billing/topup` | Add money to the balance |
| `PUT /v1/billing/auto-topup` | Turn automatic top-up on or off, with its threshold and amount |

> [!WARNING]
>
> **If your credit and balance both run out and automatic top-up is off, your sandboxes are put to sleep, and new
> ones are refused** with `402 payment_required` until money arrives. Nothing is deleted. For anything your users
> depend on, turn on automatic top-up.

## Related

> [card] [Pricing and limits](https://docs.fibre.dev/get-started/pricing.md)
>
> The price of each size, the plans and the free trial.

> [card] [Sleep and wake](https://docs.fibre.dev/sandboxes/sleep-and-wake.md)
>
> Sleep is the biggest factor in what you spend.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.