Shows one provider account's own usage dashboard.
Shows one provider account's own usage dashboard.
GET /v1/link/usage
| Address | https://api.hanzo.ai/v1/link/usage |
| Method | GET |
| Operation | get_link_usage |
| Auth | Authorization: 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.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
provider | query | string | — | Provider is the provider whose meter to read. |
account | query | string | — | Account narrows to one account when a user has several with the provider. |
window | query | string | — | Window selects a window class: 6h, day, week or month. |
range | query | string | — | 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
| Status | Body | Meaning |
|---|---|---|
200 | boardResp | ok |
200 body — 48 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
account | body | string | — | Account is the account the series narrows to, when one was named. |
available | body | boolean | — | Available reports whether the warehouse answered; false is an honest "we have no data", NOT zero usage. |
current | body | readingView[] | — | Current is the live state of each lane — the dash headline. |
current[].account | body | string | — | Account is the provider-side account the sample belongs to. |
current[].cachedInputTokens | body | integer | — | CachedInputTokens is the window's cached-prompt-token count. |
current[].confidence | body | string | — | Confidence says whether the counters that remain mean anything, as the meter graded itself. |
current[].costCents | body | integer | — | CostCents is the window's spend in cents, as the provider's meter states it. |
current[].costLimitCents | body | integer | — | CostLimitCents is the window's spend cap in cents, when the meter knows one. |
current[].currency | body | string | — | Currency is the ISO currency the cost fields are stated in. |
current[].inputTokens | body | integer | — | InputTokens is the window's prompt-token count. |
current[].lane | body | string | — | Lane names the meter's own lane label for this measurement. |
current[].machine | body | string | — | Machine is the machine the collector observed the account on. |
current[].outputTokens | body | integer | — | OutputTokens is the window's completion-token count. |
current[].plan | body | string | — | Plan is the provider plan label the account is on. |
current[].requests | body | integer | — | Requests is the window's request count. |
current[].resetsAt | body | string | — | ResetsAt is when the window resets, RFC 3339 UTC. |
current[].synthetic | body | boolean | — | Synthetic marks a sample the collector derived rather than observed. |
current[].totalTokens | body | integer | — | TotalTokens is the window's total token count. |
current[].usedPct | body | number | — | UsedPct is how much of the window's allowance is consumed, 0..100. |
current[].window | body | string | — | Window is the window class: 6h, day, week or month. |
current[].windowMinutes | body | integer | — | WindowMinutes is the window's length as the meter reported it. |
current[].windowStart | body | string | — | WindowStart is when the measured window opened, RFC 3339 UTC. |
from | body | string | — | From is when the resolved window opens, RFC 3339 UTC. |
provider | body | string | — | Provider is the provider whose meter answered. |
range | body | string | — | Range is the resolved period label. |
scope | body | string | — | Scope is always "user": the caller's own linked accounts. |
source | body | string | — | Source is always "account": the provider's own meter, not a Hanzo charge. |
to | body | string | — | 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… |
windows | body | readingView[] | — | Windows is every window instance in range, newest first. |
windows[].account | body | string | — | Account is the provider-side account the sample belongs to. |
windows[].cachedInputTokens | body | integer | — | CachedInputTokens is the window's cached-prompt-token count. |
windows[].confidence | body | string | — | Confidence says whether the counters that remain mean anything, as the meter graded itself. |
windows[].costCents | body | integer | — | CostCents is the window's spend in cents, as the provider's meter states it. |
windows[].costLimitCents | body | integer | — | CostLimitCents is the window's spend cap in cents, when the meter knows one. |
windows[].currency | body | string | — | Currency is the ISO currency the cost fields are stated in. |
windows[].inputTokens | body | integer | — | InputTokens is the window's prompt-token count. |
windows[].lane | body | string | — | Lane names the meter's own lane label for this measurement. |
windows[].machine | body | string | — | Machine is the machine the collector observed the account on. |
windows[].outputTokens | body | integer | — | OutputTokens is the window's completion-token count. |
windows[].plan | body | string | — | Plan is the provider plan label the account is on. |
windows[].requests | body | integer | — | Requests is the window's request count. |
windows[].resetsAt | body | string | — | ResetsAt is when the window resets, RFC 3339 UTC. |
windows[].synthetic | body | boolean | — | Synthetic marks a sample the collector derived rather than observed. |
windows[].totalTokens | body | integer | — | TotalTokens is the window's total token count. |
windows[].usedPct | body | number | — | UsedPct is how much of the window's allowance is consumed, 0..100. |
windows[].window | body | string | — | Window is the window class: 6h, day, week or month. |
windows[].windowMinutes | body | integer | — | WindowMinutes is the window's length as the meter reported it. |
windows[].windowStart | body | string | — | WindowStart is when the measured window opened, RFC 3339 UTC. |
Failure carries the platform error shape — see Errors.
Examples
hanzo links usage getimport { 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 := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.LinkAPI.GetLinkUsage(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::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.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new LinkApi(client).getLinkUsage();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
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": {}
}
}
}'How is this guide?