Every billed call the caller's org made, attributed to a product
Answers one row per BILLED call against the caller's org — transaction id, amount, timestamp and the metered unit.
GET /v1/billing/usage
| Address | https://api.hanzo.ai/v1/billing/usage |
| Method | GET |
| Operation | get_billing_usage |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Answers one row per BILLED call against the caller's org — transaction id, amount, timestamp and the metered unit. This is the raw charged ledger, not a rollup.
Each row is stamped with a canonical metadata.product derived from what the meter persisted: agent becomes agents, provisioning becomes the provisioned kind, a token-metered row becomes inference, anything else keeps its metering surface. The ledger has no product field of its own, so this read is where that dimension is made real — from the SAME charged rows, never a second meter. A row that already carries its own product WINS, so the derivation stops the day the meter records one.
product=<id> filters to one product server-side. groupBy=product reduces to {product,requests,amountCents} rollups instead of rows.
amount is whole USD cents, ROUNDED; decimal beside it is the SAME debit exact, as an 18-decimal USD string. Sum decimal. A page of sub-cent token calls totals correctly there and totals ZERO in amount — that difference is real money.
Scoped to the caller's own org's books, where the org's ledger file IS the tenant boundary; no client-supplied subject is ever forwarded. 401 without a validated principal. The co-resident read returns the 2000 most recent debits, newest first; start and end narrow the window only on the split-deploy upstream.
Request
GET /v1/billing/usage takes no parameters and no body — the credential is the whole request.
Response
The document declares no response body for this operation. It answers 200 on success and the platform error shape on failure — see Errors.
Examples
hanzo billing usage getimport { Configuration, BillingApi } from 'hanzoai';
const api = new BillingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getBillingUsage();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()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.BillingAPI.GetBillingUsage(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(&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).getBillingUsage();curl https://api.hanzo.ai/v1/billing/usage \
-H "Authorization: Bearer $HANZO_API_KEY"Tool billing, op get_billing_usage — 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": "billing",
"arguments": {
"op": "get_billing_usage",
"input": {}
}
}
}'How is this guide?