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

# Read usage and billing

> Read one month of usage per meter, find the services that drive the cost, and check the budgets that cap overage.

Usage is counted for each organization, in calendar months (UTC). This recipe reads the usage of a
month, the cost per service, and the budgets. All three requests are read-only. Any member of the
organization, and an API key of a project in it, can read them. See
[Organizations API](https://docs.squasher.ai/api-reference/organizations.md).

The CLI finds your organization from your credential. For the REST API and MCP, you need the
organization ID. The projects list returns it as `organization_id`.

## Read the usage of a month

`period` is a month as `YYYY-MM`. It defaults to the current month. A future month returns `400`.

> [tab] CLI
>
> ```bash theme={null}
> squasher usage --month 2026-10
> squasher usage --month 2026-10 --json
> ```
>
> Without `--json`, the command prints a table with one row for each meter. Then it shows the AI
> triage of the month: the issues triaged against the plan's
> [monthly AI triage limit](https://docs.squasher.ai/features/plans-and-billing.md#monthly-ai-triage-limit), the percent of
> the limit used, the state (within limit, near limit, or paused at limit), and the reset date.

> [tab] MCP
>
> ```javascript theme={null}
> const projects = await squasher.request({ method: "GET", path: "/v1/projects" });
> const organizationId = projects[0].organization_id;
> const usage = await squasher.request({
>   method: "GET",
>   path: `/v1/organizations/${organizationId}/usage`,
>   query: { period: "2026-10" },
> });
> return {
>   plan: usage.plan,
>   usage_charge_cents: usage.usage_charge_cents,
>   meters: usage.meters.map((m) => ({
>     meter: m.meter,
>     used: m.used,
>     included: m.included,
>     overage: m.overage,
>   })),
> };
> ```

> [tab] REST API
>
> ```bash theme={null}
> curl "https://api.squasher.ai/v1/projects" -H "x-squasher-key: $SQUASHER_API_KEY"
>
> curl -G "https://api.squasher.ai/v1/organizations/ORGANIZATION_ID/usage" \
>   -H "x-squasher-key: $SQUASHER_API_KEY" \
>   --data-urlencode period=2026-10
> ```

The response has the plan, the month, and one entry in `meters` for each meter:

```json theme={null}
{
  "organization_id": "<uuid>",
  "period": "2026-10",
  "plan": "pro",
  "closed": true,
  "base_price_cents": 2900,
  "usage_charge_cents": 0,
  "meters": [
    {
      "meter": "logs",
      "label": "Telemetry",
      "unit": "gb",
      "billing_status": "cataloged",
      "used": 42,
      "included": 100,
      "overage": 0,
      "charge_cents": 0,
      "limit": { "kind": "<kind>", "reached": false },
      "budget": { "mode": "alert", "amount_cents": 5000, "spent_cents": 0, "state": "ok" },
      "daily": [{ "day": "<YYYY-MM-DD>", "quantity": 1 }],
      "projects": [{ "project_id": "<uuid>", "name": "<project>", "quantity": 42, "share": 1 }]
    }
  ]
}
```

The meters are `logs` (telemetry), `replays`, `checks` (monitor checks), `aiCredits`, `smsAlerts`,
and `voiceAlerts`. `usage_charge_cents` is an estimate: the invoice is the record.
A meter with `billing_status: "not_billed"` is counted but has no overage charge.

## Find what drives the cost

Group the cost by `service`, `signal`, `project`, `meter`, or `tag:<resource attribute key>`.
`limit` shows the top groups, and the rest are under `__other__`.

> [tab] CLI
>
> ```bash theme={null}
> squasher costs --group-by service --limit 5 --json
> ```

> [tab] MCP
>
> ```javascript theme={null}
> const projects = await squasher.request({ method: "GET", path: "/v1/projects" });
> const organizationId = projects[0].organization_id;
> const costs = await squasher.request({
>   method: "GET",
>   path: `/v1/organizations/${organizationId}/costs`,
>   query: { group_by: "service", limit: 5 },
> });
> return {
>   totals: costs.totals,
>   groups: costs.groups.map((g) => ({ key: g.key, billed_cents: g.billed_cents })),
> };
> ```

> [tab] REST API
>
> ```bash theme={null}
> curl -G "https://api.squasher.ai/v1/organizations/ORGANIZATION_ID/costs" \
>   -H "x-squasher-key: $SQUASHER_API_KEY" \
>   --data-urlencode group_by=service \
>   --data-urlencode limit=5
> ```

The response has `groups`, a `series` of daily buckets, `totals`, and the `rates` used. Each group has
`key`, `billed_cents`, `list_cents`, and its `meters`. `from` defaults to the start of the month
and `to` to now. The report reads only the usage meters, never your telemetry.

## Check the budgets

A budget caps the overage of one meter. In mode `alert`, Squasher notifies you at the cap. In mode
`stop`, Squasher refuses new usage of the meter until the month ends or you raise the budget.

> [tab] CLI
>
> ```bash theme={null}
> squasher budgets list --json
> ```

> [tab] MCP
>
> ```javascript theme={null}
> const projects = await squasher.request({ method: "GET", path: "/v1/projects" });
> const organizationId = projects[0].organization_id;
> const { budgets } = await squasher.request({
>   method: "GET",
>   path: `/v1/organizations/${organizationId}/budgets`,
> });
> return budgets.map((b) => ({ meter: b.meter, mode: b.mode, state: b.state, spent_cents: b.spent_cents }));
> ```

> [tab] REST API
>
> ```bash theme={null}
> curl "https://api.squasher.ai/v1/organizations/ORGANIZATION_ID/budgets" \
>   -H "x-squasher-key: $SQUASHER_API_KEY"
> ```

On the Free plan, `available` is `false` and `budgets` is empty. `state` is `ok`, `warning`
(80% spent), `reached`, or `stopped`.

Changing a budget needs an owner or billing admin in a signed-in session. An API key cannot do it.
Do not change budgets from an agent without the person's approval.

## Compare the plans

```bash theme={null}
squasher billing plans --json
```

The REST API has `GET /v1/billing/plans`. It returns one entry for each plan (`free`, `pro`, `team`,
`scale`) with its limits and capabilities.

## Next steps

> [card] [Usage and budgets](https://docs.squasher.ai/features/usage-and-budgets.md)
>
> What each meter counts and how budgets stop usage.

> [card] [Plans and billing](https://docs.squasher.ai/features/plans-and-billing.md)
>
> Compare plans and change yours.


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