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

# Usage and billing

> What is metered, and where to read it: dashboard, CLI, MCP and API.

Usage is metered per sandbox and priced at your plan's [rates](/docs/pricing.md). Each plan includes some usage; see [Plans and codes](/docs/plans-and-codes.md) for choosing a plan, discount codes and usage alerts. Paid plans are paid on the secure Stripe checkout page; invoices and receipts come from Stripe.

## Where to see it

| Where | What | Who |
| - | - | - |
| Dashboard **Usage** page | The month by day, per meter, per sandbox and per template | Every role |
| Dashboard **Billing** page | Plan, included usage left, codes, invites, rates and invoices | Owners and admins |
| `anona-compute usage` | Meters, totals, the part not yet rated, a projection for the current month, the most expensive sandboxes | Browser sign-in of any role, or a key with `usage:read` |
| `anona-compute usage --billing` | Plan, rates and invoices | Owners and admins, or a key with `billing:read` |
| MCP tool `get_usage` | The same as `anona-compute usage`, for agents | As above |
| `GET /v1/usage`, `GET /v1/billing` | The JSON documents behind all of the above | As above |

API keys need the scope: the **Read only** preset has `usage:read`, **Full access** has both. Keys created before these scopes existed do not have them.

```bash usage.sh
anona-compute usage                         # this month
anona-compute usage --period 2026-10 --top 10
anona-compute usage --json | jq '{period: .period.key, total: .totals.amount_usd, meters: [.meters[] | {meter, quantity}]}'
anona-compute usage --billing --json | jq '{provider, rates: [.rates[] | {meter, unit_price_usd}]}'
```

```python usage_api.py
import os
import httpx

r = httpx.get(
    "https://api.compute.anonalabs.com/v1/usage",
    params={"period": "current"},
    headers={"X-API-Key": os.environ["ANONA_API_KEY"]},
)
r.raise_for_status()
usage = r.json()
print(usage["period"]["key"], usage["totals"]["amountUsd"], usage["totals"].get("projectedUsd"))
for m in usage["meters"]:
    print(f'{m["meter"]:<20} {m["quantity"]:>10.3f} {m["unit"]:<10} ${m["amountUsd"]:.4f}')
```

### Every sandbox's row

`GET /v1/usage` returns the period's sandboxes most expensive first, 50 to a page unless you pass `limit` (at most 1000). `sandboxCount` says how many there are; while more remain, the response has `nextCursor`, which you pass back as `cursor` with the same `period`. Pass `sandboxId` instead to read one sandbox's row wherever it ranks. `anona-compute usage --top N` reads as many pages as it needs, and `--sandbox <id>` reads one row. The fields of each row, and which are allocated (size times running time) and which are consumed, are in the [API reference](/docs/api-reference/usage-and-billing/usage-and-cost.md).

```python usage_pages.py
import os
import httpx

params = {"period": "current", "limit": 1000}
rows = []
while True:
    r = httpx.get(
        "https://api.compute.anonalabs.com/v1/usage",
        params=params,
        headers={"X-API-Key": os.environ["ANONA_API_KEY"]},
    )
    r.raise_for_status()
    page = r.json()
    rows += page["sandboxes"]
    if "nextCursor" not in page:
        break
    params["cursor"] = page["nextCursor"]
print(len(rows), "of", page["sandboxCount"], "sandboxes")
```

## What counts

Usage is billed on what a sandbox is given ([Pricing](/docs/pricing.md)):

| Meter | Counted when |
| - | - |
| Allocated vCPU-hours | The sandbox runs: its vCPU count for every second it runs |
| Allocated GiB-hours | The sandbox runs: its memory for every second it runs |
| Storage GiB-hours | A paused sandbox's snapshot exists |
| Egress, GB | Bytes leave the sandbox to the internet |

Running time is billed per second, with a 1-minute minimum: a sandbox that ran less than a minute in total is billed one minute of vCPU and memory at its size, and above a minute every second is billed. The minimum is added a few minutes after the sandbox ends, to the hour it started in.

Deleting a sandbox stops all four. Pausing stops the first two. Each month's report also shows the month against what your plan includes (`included` in `GET /v1/usage`, the dashboard's Usage and Billing pages, and `anona-compute usage`): vCPU-hours and memory used of what is included, egress, storage, and what is over. Owners and admins are emailed at 80% and 100% of the included vCPU-hours and egress. Free stops when the included usage is used up; paid plans are billed for what is over on the next invoice. A credit balance you already have pays for what is over first, on any plan, until it is spent.

Months before the current plans are reported with the meters they were billed on then.

Deleting or pausing a sandbox stops its vCPU and memory charges. Usage is rated hourly; until then the totals show it as `pendingUsd`, estimated at the same rates.

Running time counts from the moment a sandbox starts to the moment you delete or pause it. It is measured from samples taken every 10 seconds and clipped to the start and delete times, so it never exceeds that span, and it usually falls short of it by a few seconds at most. A resumed sandbox can be counted up to 10 seconds more than it ran, once per resume.

Usage arrives a minute at a time. A minute appears within about 35 seconds of its end, so the last minute of a sandbox you just deleted is not in the totals until then. Wait that long before comparing a sandbox's running time with its lifetime.

## Coming soon

Spend caps you set yourself. For per-sandbox metrics in your own monitoring, see [OpenTelemetry export](/docs/guides/webhooks.md#opentelemetry-export).


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