# List usage

URL: https://docs.hanzo.ai/docs/openapi/link/get-link-usage

> Shows one provider account's own usage dashboard.

`GET /v1/link/usage`

> [Link →](https://docs.hanzo.ai/docs/openapi/link) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **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`     | link.boardResp  | ok      |
| `default` | problem-details | refused |

`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 | link.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 (int64)     | —      | 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 (int64)     | —      | CostCents is the window's spend in cents, as the provider's meter states it.                                                                                                            |
| `current[].costLimitCents`    | body | integer (int64)     | —      | 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 (int64)     | —      | 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 (int64)     | —      | 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 (int64)     | —      | 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 (int64)     | —      | TotalTokens is the window's total token count.                                                                                                                                          |
| `current[].usedPct`           | body | number (double)     | —      | 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 (int32)     | —      | 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 not cover the same period. |
| `windows`                     | body | link.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 (int64)     | —      | 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 (int64)     | —      | CostCents is the window's spend in cents, as the provider's meter states it.                                                                                                            |
| `windows[].costLimitCents`    | body | integer (int64)     | —      | 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 (int64)     | —      | 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 (int64)     | —      | 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 (int64)     | —      | 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 (int64)     | —      | TotalTokens is the window's total token count.                                                                                                                                          |
| `windows[].usedPct`           | body | number (double)     | —      | 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 (int32)     | —      | 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](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo auth link usage get
```

**SDK**

**.ts**

```ts
import { Configuration, LinkApi } from 'hanzoai';

const api = new LinkApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getLinkUsage();
```

**.py**

```python
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()
```

**.go**

```go
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
}
```

**.rs**

```rust
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?;
```

**.java**

```java
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();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/link/usage \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

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

```bash
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](https://docs.hanzo.ai/docs/openapi/link) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
