Answers per-account totals for the linked provider accounts the gateway ROUTED…
Answers per-account totals for the linked provider accounts the gateway ROUTED this caller's traffic through — requests, prompt and completion tokens,…
GET /v1/billing/usage/accounts
| 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 | accounts | ok |
200 body — 19 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
accounts | body | 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 | — | CompletionTokens is the routed completion-token count. |
accounts[].costCents | body | integer | — | CostCents is the routed cost in cents. |
accounts[].kind | body | string | — | Kind is how the account authenticates: subscription or apikey. |
accounts[].promptTokens | body | integer | — | 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 | — | Requests is how many requests the gateway routed through this account. |
accounts[].totalTokens | body | integer | — | TotalTokens is the routed total token count. |
scope | body | string | — | |
source | body | string | — | |
total | body | AccountsTotal | — | |
total.accounts | body | integer | — | Accounts is how many linked accounts the total folds. |
total.completionTokens | body | integer | — | CompletionTokens is the total completion-token count. |
total.costCents | body | integer | — | CostCents is the total cost in cents. |
total.promptTokens | body | integer | — | PromptTokens is the total prompt-token count. |
total.requests | body | integer | — | Requests is the total request count the gateway routed. |
total.totalTokens | body | integer | — | TotalTokens is the total token count. |
Failure carries the platform error shape — see Errors.
Examples
hanzo billing usage accountsimport { Configuration, BillingApi } from 'hanzoai';
const api = new BillingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getBillingUsageAccounts();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()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.BillingAPI.GetBillingUsageAccounts(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::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?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.BillingApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new BillingApi(client).getBillingUsageAccounts();curl https://api.hanzo.ai/v1/billing/usage/accounts \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches billing through the billing tool, which names its 9 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
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": "get_billing_balance"
}
}
}'How is this guide?