List summary

Answers GET /v1/usage/summary: the caller's own usage footprint over one window — the categorized spend roll-up from the commerce ledger, the org's LLM usage totals from the warehouse, and the caller's OWN linked provider accounts beside the org's Hanzo-routed usage.

GET /v1/usage/summary

Addresshttps://api.hanzo.ai/v1/usage/summary
MethodGET
Operationget_usage_summary
AuthAuthorization: Bearer $HANZO_API_KEY

Answers GET /v1/usage/summary: the caller's own usage footprint over one window — the categorized spend roll-up from the commerce ledger, the org's LLM usage totals from the warehouse, and the caller's OWN linked provider accounts beside the org's Hanzo-routed usage.

Every source degrades INDEPENDENTLY to honest zeros and says so in sources and in its own available flag, so a partial deploy reports "no data" rather than fabricating spend. The account rows and the Hanzo rows are concatenated and never summed: a plan's percent is not money.

The response is org-scoped from the validated principal and marked no-store — a signed-out caller is refused.

Request

3 fields.

FieldInTypeRequiredDescription
rangequerystring—Range is the window: a count and a unit — 24h, 7d, 90d, any <N>h or <N>d — or day, week, month, all, custom.
startquerystring—Start is the inclusive window start, RFC3339.
endquerystring—End is the exclusive window end, RFC3339.

Response

StatusBodyMeaning
200usage.usageSummaryok
defaultproblem-detailsrefused

200 body — 56 fields.

FieldInTypeAlwaysDescription
accountsbodyusage.Accounts—
accounts.accountbodyusage.SourceState—
accounts.account.availablebodyboolean—Available is whether this side's ledger answered.
accounts.account.notebodystring—Note is the human sentence that says what this side's numbers mean, so a board cannot present a plan percentage as a Hanzo charge.
accounts.account.scopebodystring—Scope is whose rows this side carries: "user" or "org".
accounts.account.sourcebodystring—Source is the table of record the rows came from.
accounts.hanzobodyusage.SourceState—
accounts.hanzo.availablebodyboolean—Available is whether this side's ledger answered.
accounts.hanzo.notebodystring—Note is the human sentence that says what this side's numbers mean, so a board cannot present a plan percentage as a Hanzo charge.
accounts.hanzo.scopebodystring—Scope is whose rows this side carries: "user" or "org".
accounts.hanzo.sourcebodystring—Source is the table of record the rows came from.
accounts.rowsbodyusage.TotalView[]—Rows is the two row sets CONCATENATED, never summed — each row says which side it came from.
accounts.rows[].confidencebodystring—Confidence says how much the counters mean; a percentage-only meter leaves them at zero.
accounts.rows[].costCentsbodyinteger (int64)—CostCents is the row's cost in US cents.
accounts.rows[].providerbodystring—Provider is the upstream the usage was measured against.
accounts.rows[].requestsbodyinteger (int64)—Requests is how many requests the row covers.
accounts.rows[].scopebodystring—Scope is whose row it is: "user" for the caller's own linked accounts, "org" for the whole tenant's Hanzo-routed usage.
accounts.rows[].sourcebodystring—Source is where the row came from: "account" is the provider's own meter on the caller's linked account, "hanzo" is Hanzo-routed inference.
accounts.rows[].tokensbodyinteger (int64)—Tokens is the total tokens the row covers.
accounts.rows[].usedPctbodynumber (double)—UsedPct is how much of a plan window the row consumed, 0–100.
accounts.rows[].windowbodystring—Window is the meter window class the row rolls up, when it has one.
accounts.rows[].windowsbodyinteger (int64)—Windows is how many window instances rolled up into the row.
endbodystring—End is the window's exclusive end, RFC3339 UTC.
intervalbodystring—Interval is the bucket width the spend series is gap-filled at.
llmbodyusage.LLM—
llm.availablebodyboolean—Available is false when the warehouse was not connected or a query blipped.
llm.completionTokensbodyinteger (int64)—CompletionTokens is the output half.
llm.costCentsbodyinteger (int64)—CostCents is what they cost the org, in US cents.
llm.modelsbodyinteger (int64)—Models is how many distinct models were used.
llm.promptTokensbodyinteger (int64)—PromptTokens is the input half of that total.
llm.requestsbodyinteger (int64)—Requests is how many completions the org made in the window.
llm.sourcebodystring—Source names the warehouse table the totals came from.
llm.tokensbodyinteger (int64)—Tokens is the total tokens those completions consumed.
rangebodystring—Range is the window label that was served.
scopebodyusage.usageScope—
scope.orgbodystring—Org is the IAM org slug the rows were read under — the validated principal's, never a client header.
scope.userbodystring—User is the caller's own subject, whose linked-account rows the accounts block carries.
sourcesbodyusage.Sources—
sources.commercebodyboolean—Commerce is whether the billing ledger answered the spend block.
sources.warehousebodyboolean—Warehouse is whether the usage warehouse answered the LLM block.
spendbodyusage.Spend—
spend.availablebodyboolean—Available is false when the commerce ledger was unconfigured or unreachable.
spend.availableCentsbodyinteger (int64)—AvailableCents is what of that balance is still spendable.
spend.balanceCentsbodyinteger (int64)—BalanceCents is the prepaid wallet's balance, in US cents.
spend.byCategorybodyusage.CategorySpend[]—ByCategory is the window's spend split by ledger category, largest first.
spend.byCategory[].categorybodystring—Category is the bucket the ledger's own tag mapped to.
spend.byCategory[].centsbodyinteger (int64)—Cents is what the org spent in that bucket over the window, in US cents.
spend.byCategory[].countbodyinteger (int64)—Count is how many ledger lines rolled up into it.
spend.mtdCentsbodyinteger (int64)—MTDCents is commerce's authoritative month-to-date consumed figure, which is a different period from the window and is not derived from it.
spend.overageCentsbodyinteger (int64)—OverageCents is month-to-date consumption beyond the plan's allowance.
spend.seriesbodyusage.SpendPoint[]—Series is the window's spend over time, gap-filled at the window's interval.
spend.series[].centsbodyinteger (int64)—Cents is the consumption recorded in that bucket, in US cents.
spend.series[].tbodystring—T is the bucket's start instant, RFC3339 UTC.
spend.sourcebodystring—Source names where the roll-up came from.
spend.totalCentsbodyinteger (int64)—TotalCents is consumption over the requested window, in US cents.
startbodystring—Start is the window's inclusive start, RFC3339 UTC.

Failure carries the platform error shape — see Errors.

Examples

hanzo usage summary
import { Configuration, UsageApi } from 'hanzoai';

const api = new UsageApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getUsageSummary();
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import UsageApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = UsageApi(client).get_usage_summary()
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.UsageAPI.GetUsageSummary(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, usage_api};

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

let result = usage_api::get_usage_summary(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.UsageApi;

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

var result = new UsageApi(client).getUsageSummary();
curl https://api.hanzo.ai/v1/usage/summary \
  -H "Authorization: Bearer $HANZO_API_KEY"

Tool usage, op get_usage_summary — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "usage",
         "arguments": {
           "op": "get_usage_summary",
           "input": {}
         }
       }
     }'

Usage API · All Hanzo APIs · Interactive reference

Was this page useful?