# List accounts — GET /v1/billing/usage/accounts

URL: https://docs.hanzo.ai/docs/openapi/billing/get-billing-usage-accounts

> Answers per-account totals for the linked provider accounts the gateway ROUTED this caller's traffic through — requests, prompt and completion tokens, recorded cost — plus their honest sum.

`GET /v1/billing/usage/accounts`

> [Billing →](https://docs.hanzo.ai/docs/openapi/billing) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                  |
| ------------- | ------------------------------------------------ |
| **Address**   | `https://api.hanzo.ai/v1/billing/usage/accounts` |
| **Method**    | `GET`                                            |
| **Operation** | `get_billing_usage_accounts`                     |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`           |

Answers per-account totals for the linked provider accounts the
gateway ROUTED this caller's traffic through — requests, prompt and completion
tokens, recorded cost — plus their honest sum.

This is the one read in the billing namespace scoped to the PERSON, not the
org. Rows are keyed on (validated org, validated user), so a caller sees the
accounts THEY linked and never a colleague's, even inside one org — everything
else under /v1/billing is org-wide. Neither key is ever read from the request
body or the query.

It is a ROUTING counter, not the money ledger. `costCents` is 0 for an account
billed by its own subscription, where the plan pays the provider directly, so
these totals do not reconcile against what the org was charged.
/v1/billing/usage is the charged ledger.

401 without a validated principal. Where the linked-account plane is not
resident the answer is an honest 501 — never an empty breakdown, which would
read as no usage.

## Request

`GET /v1/billing/usage/accounts` takes no parameters and no body — the credential is the whole request.

## Response

| Status    | Body             | Meaning |
| --------- | ---------------- | ------- |
| `200`     | billing.accounts | ok      |
| `default` | problem-details  | refused |

`200` body — 19 fields.

| Field                         | In   | Type                   | Always | Description                                                            |
| ----------------------------- | ---- | ---------------------- | ------ | ---------------------------------------------------------------------- |
| `accounts`                    | body | billing.RoutedUsage\[] | —      |                                                                        |
| `accounts[].account`          | body | string                 | —      | Account is the provider-side account identifier.                       |
| `accounts[].billing`          | body | string                 | —      | Billing is how the routed inference bills: plan or commerce.           |
| `accounts[].completionTokens` | body | integer (int64)        | —      | CompletionTokens is the routed completion-token count.                 |
| `accounts[].costCents`        | body | integer (int64)        | —      | CostCents is the routed cost in cents.                                 |
| `accounts[].kind`             | body | string                 | —      | Kind is how the account authenticates: subscription or apikey.         |
| `accounts[].promptTokens`     | body | integer (int64)        | —      | PromptTokens is the routed prompt-token count.                         |
| `accounts[].provider`         | body | string                 | —      | Provider is the AI provider the row's account belongs to.              |
| `accounts[].requests`         | body | integer (int64)        | —      | Requests is how many requests the gateway routed through this account. |
| `accounts[].totalTokens`      | body | integer (int64)        | —      | TotalTokens is the routed total token count.                           |
| `scope`                       | body | string                 | —      |                                                                        |
| `source`                      | body | string                 | —      |                                                                        |
| `total`                       | body | billing.AccountsTotal  | —      |                                                                        |
| `total.accounts`              | body | integer (int64)        | —      | Accounts is how many linked accounts the total folds.                  |
| `total.completionTokens`      | body | integer (int64)        | —      | CompletionTokens is the total completion-token count.                  |
| `total.costCents`             | body | integer (int64)        | —      | CostCents is the total cost in cents.                                  |
| `total.promptTokens`          | body | integer (int64)        | —      | PromptTokens is the total prompt-token count.                          |
| `total.requests`              | body | integer (int64)        | —      | Requests is the total request count the gateway routed.                |
| `total.totalTokens`           | body | integer (int64)        | —      | TotalTokens is the total token count.                                  |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo billing usage accounts
```

**SDK**

**.ts**

```ts
import { Configuration, BillingApi } from 'hanzoai';

const api = new BillingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getBillingUsageAccounts();
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import BillingApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = BillingApi(client).get_billing_usage_accounts()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.BillingAPI.GetBillingUsageAccounts(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, billing_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = billing_api::get_billing_usage_accounts(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.BillingApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new BillingApi(client).getBillingUsageAccounts();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/billing/usage/accounts \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

MCP reaches **billing** through the `billing` tool, which names its 39 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_billing_accounts"
         }
       }
     }'
```

---

[Billing API](https://docs.hanzo.ai/docs/openapi/billing) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
