List usage

Shows one provider account's own usage dashboard.

GET /v1/link/usage

Addresshttps://api.hanzo.ai/v1/link/usage
MethodGET
Operationget_link_usage
AuthAuthorization: Bearer $HANZO_API_KEY

Shows one provider account's own usage dashboard.

It answers the time series for a SINGLE provider account — the windows in range plus the currently-open ones — as that provider's own meter reported it: "my plan is 47% through its 6h window, resets at 14:20". current is the newest instance of each lane (the headline); windows is the history behind it, both computed from ONE deduped read. provider is required; an unknown window class or range is 400, never a quiet fallback to a different one. When no series is available the response is a 200 with available:false and empty lists — an honest "we have no data", which is a different claim from zero usage.

Request

4 fields.

FieldInTypeRequiredDescription
providerquerystring—Provider is the provider whose meter to read.
accountquerystring—Account narrows to one account when a user has several with the provider.
windowquerystring—Window selects a window class: 6h, day, week or month.
rangequerystring—Range is the period, one of 1h, 24h, 7d or 30d; empty means 24h, and an unknown label is 400, never a quiet fallback.

Response

StatusBodyMeaning
200link.boardRespok
defaultproblem-detailsrefused

200 body — 48 fields.

FieldInTypeAlwaysDescription
accountbodystring—Account is the account the series narrows to, when one was named.
availablebodyboolean—Available reports whether the warehouse answered; false is an honest "we have no data", NOT zero usage.
currentbodylink.readingView[]—Current is the live state of each lane — the dash headline.
current[].accountbodystring—Account is the provider-side account the sample belongs to.
current[].cachedInputTokensbodyinteger (int64)—CachedInputTokens is the window's cached-prompt-token count.
current[].confidencebodystring—Confidence says whether the counters that remain mean anything, as the meter graded itself.
current[].costCentsbodyinteger (int64)—CostCents is the window's spend in cents, as the provider's meter states it.
current[].costLimitCentsbodyinteger (int64)—CostLimitCents is the window's spend cap in cents, when the meter knows one.
current[].currencybodystring—Currency is the ISO currency the cost fields are stated in.
current[].inputTokensbodyinteger (int64)—InputTokens is the window's prompt-token count.
current[].lanebodystring—Lane names the meter's own lane label for this measurement.
current[].machinebodystring—Machine is the machine the collector observed the account on.
current[].outputTokensbodyinteger (int64)—OutputTokens is the window's completion-token count.
current[].planbodystring—Plan is the provider plan label the account is on.
current[].requestsbodyinteger (int64)—Requests is the window's request count.
current[].resetsAtbodystring—ResetsAt is when the window resets, RFC 3339 UTC.
current[].syntheticbodyboolean—Synthetic marks a sample the collector derived rather than observed.
current[].totalTokensbodyinteger (int64)—TotalTokens is the window's total token count.
current[].usedPctbodynumber (double)—UsedPct is how much of the window's allowance is consumed, 0..100.
current[].windowbodystring—Window is the window class: 6h, day, week or month.
current[].windowMinutesbodyinteger (int32)—WindowMinutes is the window's length as the meter reported it.
current[].windowStartbodystring—WindowStart is when the measured window opened, RFC 3339 UTC.
frombodystring—From is when the resolved window opens, RFC 3339 UTC.
providerbodystring—Provider is the provider whose meter answered.
rangebodystring—Range is the resolved period label.
scopebodystring—Scope is always "user": the caller's own linked accounts.
sourcebodystring—Source is always "account": the provider's own meter, not a Hanzo charge.
tobodystring—To is where it closes, EXCLUSIVE, RFC 3339 UTC — the instant the read was served, so the window walks forward with the clock and two reads a minute apart do not cover the same period.
windowsbodylink.readingView[]—Windows is every window instance in range, newest first.
windows[].accountbodystring—Account is the provider-side account the sample belongs to.
windows[].cachedInputTokensbodyinteger (int64)—CachedInputTokens is the window's cached-prompt-token count.
windows[].confidencebodystring—Confidence says whether the counters that remain mean anything, as the meter graded itself.
windows[].costCentsbodyinteger (int64)—CostCents is the window's spend in cents, as the provider's meter states it.
windows[].costLimitCentsbodyinteger (int64)—CostLimitCents is the window's spend cap in cents, when the meter knows one.
windows[].currencybodystring—Currency is the ISO currency the cost fields are stated in.
windows[].inputTokensbodyinteger (int64)—InputTokens is the window's prompt-token count.
windows[].lanebodystring—Lane names the meter's own lane label for this measurement.
windows[].machinebodystring—Machine is the machine the collector observed the account on.
windows[].outputTokensbodyinteger (int64)—OutputTokens is the window's completion-token count.
windows[].planbodystring—Plan is the provider plan label the account is on.
windows[].requestsbodyinteger (int64)—Requests is the window's request count.
windows[].resetsAtbodystring—ResetsAt is when the window resets, RFC 3339 UTC.
windows[].syntheticbodyboolean—Synthetic marks a sample the collector derived rather than observed.
windows[].totalTokensbodyinteger (int64)—TotalTokens is the window's total token count.
windows[].usedPctbodynumber (double)—UsedPct is how much of the window's allowance is consumed, 0..100.
windows[].windowbodystring—Window is the window class: 6h, day, week or month.
windows[].windowMinutesbodyinteger (int32)—WindowMinutes is the window's length as the meter reported it.
windows[].windowStartbodystring—WindowStart is when the measured window opened, RFC 3339 UTC.

Failure carries the platform error shape — see Errors.

Examples

hanzo auth link usage get
import { Configuration, LinkApi } from 'hanzoai';

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

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

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

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

let result = link_api::get_link_usage(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.LinkApi;

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

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

Tool link, op get_link_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": "link",
         "arguments": {
           "op": "get_link_usage",
           "input": {}
         }
       }
     }'

Link API · All Hanzo APIs · Interactive reference

Was this page useful?