List accounts — GET /v1/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

Addresshttps://api.hanzo.ai/v1/billing/usage/accounts
MethodGET
Operationget_billing_usage_accounts
AuthAuthorization: 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

StatusBodyMeaning
200billing.accountsok
defaultproblem-detailsrefused

200 body — 19 fields.

FieldInTypeAlwaysDescription
accountsbodybilling.RoutedUsage[]—
accounts[].accountbodystring—Account is the provider-side account identifier.
accounts[].billingbodystring—Billing is how the routed inference bills: plan or commerce.
accounts[].completionTokensbodyinteger (int64)—CompletionTokens is the routed completion-token count.
accounts[].costCentsbodyinteger (int64)—CostCents is the routed cost in cents.
accounts[].kindbodystring—Kind is how the account authenticates: subscription or apikey.
accounts[].promptTokensbodyinteger (int64)—PromptTokens is the routed prompt-token count.
accounts[].providerbodystring—Provider is the AI provider the row's account belongs to.
accounts[].requestsbodyinteger (int64)—Requests is how many requests the gateway routed through this account.
accounts[].totalTokensbodyinteger (int64)—TotalTokens is the routed total token count.
scopebodystring—
sourcebodystring—
totalbodybilling.AccountsTotal—
total.accountsbodyinteger (int64)—Accounts is how many linked accounts the total folds.
total.completionTokensbodyinteger (int64)—CompletionTokens is the total completion-token count.
total.costCentsbodyinteger (int64)—CostCents is the total cost in cents.
total.promptTokensbodyinteger (int64)—PromptTokens is the total prompt-token count.
total.requestsbodyinteger (int64)—Requests is the total request count the gateway routed.
total.totalTokensbodyinteger (int64)—TotalTokens is the total token count.

Failure carries the platform error shape — see Errors.

Examples

hanzo billing usage accounts
import { 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 := 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
}
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?;
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();
curl https://api.hanzo.ai/v1/billing/usage/accounts \
  -H "Authorization: Bearer $HANZO_API_KEY"

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:

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 · All Hanzo APIs · Interactive reference

Was this page useful?