
# tdx usage

Read usage reports.

Read observability usage rollups and series as JSON. CSV export is not supported by the CLI.

Every command also takes the [global flags](/cli/reference#global-flags) and reads the [environment variables](/cli/reference#environment-variables) that the command reference lists once.

## Commands

| Command | Description | Type |
|---|---|---|
| [tdx usage report](/cli/reference/usage#tdx-usage-report) | Read a usage rollup. | Read |
| [tdx usage series](/cli/reference/usage#tdx-usage-series) | Read a usage time series. | Read |

## tdx usage report

Read a usage rollup.

**Reads**

Read one grouped rollup over the filtered window. Requires usage.read; the gateway narrows rows to the reader's reach. CSV is not supported by the CLI: format is never sent, so the gateway replies in JSON. Token counts and costUsd are the gateway's numbers, unchanged. Calls and traces are out of scope. Very large replies, such as grouping by key on installs with many keys, may exceed the masker's safety limits and are refused rather than shown partially (OUTPUT_MASK_LIMIT); narrow --since/--until, filter or group more coarsely. Uses auth status host-bound bearer rules; reads are read-only and --dry-run still reads.

```bash
# GET /observability/v1/usage
tdx usage report --group-by <agent|model|provider|key|tag|project|user|workspace> [flags]
```

**Required flags**

| Flag | Type | Default | Description |
|---|---|---|---|
| `--group-by` | one of `agent`, `model`, `provider`, `key`, `tag`, `project`, `user`, `workspace` |  | Group rows by this dimension. |

**Optional flags**

| Flag | Type | Default | Description |
|---|---|---|---|
| `--since` | datetime |  | Window start, ISO-8601 with a time zone. |
| `--until` | datetime |  | Window end, ISO-8601 with a time zone. |
| `--status` | string |  | Filter by status; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--provider` | string |  | Filter by provider; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--model` | string |  | Filter by model; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--agent` | string |  | Filter by agent; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--project` | string |  | Filter by project; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--tag` | string |  | Filter by tag; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--search` | string |  | Filter by search; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--key-id` | string |  | Filter by API key id; needs user management on: a gateway without it ignores this filter on usage report, which the CLI then refuses, and serves no usage series. |
| `--user-id` | string |  | Filter by user id; needs user management on: a gateway without it ignores this filter on usage report, which the CLI then refuses, and serves no usage series. |
| `--workspace-id` | string |  | Filter by workspace id; needs user management on: a gateway without it ignores this filter on usage report, which the CLI then refuses, and serves no usage series. |
| `--request-id` | string |  | Filter by request id; needs user management on: a gateway without it ignores this filter on usage report, which the CLI then refuses, and serves no usage series. |
| `--sessions` | one of `grouped`, `sourced` |  | Session grouping filter; needs user management on: a gateway without it ignores this filter on usage report, which the CLI then refuses, and serves no usage series. |

**Output fields** (inside `data`)

| Field | Type | Description |
|---|---|---|
| `rows` | usage-row[] | Grouped rows: name, calls, token totals, costUsd when shown, coverage. |
| `page` | page | Gateway page metadata as reported. |
| `groupBy` | string | Grouping dimension. |
| `summary` | usage-summary | Totals over the whole filtered window. |
| `window` | usage-window | Resolved since and until. |
| `money` | raw\|hidden\|null | Gateway money mode: hidden withholds every costUsd; null when the gateway omits it (user management off). |
| `directory` | attribution-directory\|null | Names and states of the keys, users and workspaces the rows name; null when omitted. |

## tdx usage series

Read a usage time series.

**Reads**

Read bucketed usage; the gateway bounds the window per interval and groups series past the top N as __other__. Requires usage.read; the gateway narrows rows to the reader's reach. CSV is not supported by the CLI: format is never sent, so the gateway replies in JSON. Token counts and costUsd are the gateway's numbers, unchanged. Calls and traces are out of scope. Very large replies, such as grouping by key on installs with many keys, may exceed the masker's safety limits and are refused rather than shown partially (OUTPUT_MASK_LIMIT); narrow --since/--until, filter or group more coarsely. Uses auth status host-bound bearer rules; reads are read-only and --dry-run still reads.

```bash
# GET /observability/v1/usage/series
tdx usage series --interval <minute|hour|day> --since <datetime> [flags]
```

**Required flags**

| Flag | Type | Default | Description |
|---|---|---|---|
| `--interval` | one of `minute`, `hour`, `day` |  | UTC bucket size. |
| `--since` | datetime |  | Window start, ISO-8601 with a time zone. |

**Optional flags**

| Flag | Type | Default | Description |
|---|---|---|---|
| `--group-by` | one of `agent`, `model`, `provider`, `key`, `tag`, `project`, `user`, `workspace` |  | Split series by this dimension. |
| `--rank-by` | one of `calls`, `costUsd`, `totalTokens` |  | Rank the top series by. |
| `--top` | integer |  | Positive integer number of series; the gateway clamps it to 20 and reports the value it used. |
| `--until` | datetime |  | Window end, ISO-8601 with a time zone. |
| `--status` | string |  | Filter by status; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--provider` | string |  | Filter by provider; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--model` | string |  | Filter by model; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--agent` | string |  | Filter by agent; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--project` | string |  | Filter by project; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--tag` | string |  | Filter by tag; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--search` | string |  | Filter by search; passed through to the gateway; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token. |
| `--key-id` | string |  | Filter by API key id; needs user management on: a gateway without it ignores this filter on usage report, which the CLI then refuses, and serves no usage series. |
| `--user-id` | string |  | Filter by user id; needs user management on: a gateway without it ignores this filter on usage report, which the CLI then refuses, and serves no usage series. |
| `--workspace-id` | string |  | Filter by workspace id; needs user management on: a gateway without it ignores this filter on usage report, which the CLI then refuses, and serves no usage series. |
| `--request-id` | string |  | Filter by request id; needs user management on: a gateway without it ignores this filter on usage report, which the CLI then refuses, and serves no usage series. |
| `--sessions` | one of `grouped`, `sourced` |  | Session grouping filter; needs user management on: a gateway without it ignores this filter on usage report, which the CLI then refuses, and serves no usage series. |

**Output fields** (inside `data`)

| Field | Type | Description |
|---|---|---|
| `interval` | string | Bucket size. |
| `window` | series-window | Floored since and exclusive until. |
| `buckets` | string[] | Every bucket start in the window. |
| `groupBy` | string\|null | Grouping dimension. |
| `rankBy` | string | Ranking. |
| `top` | integer | Series count the gateway used after clamping. |
| `series` | usage-series[] | Per-group totals and sparse points. |
| `summary` | usage-point | Window totals. |
| `money` | raw\|hidden\|null | Gateway money mode: hidden withholds every costUsd; null when the gateway omits it (user management off). |
| `directory` | attribution-directory\|null | Names and states of the keys, users and workspaces the rows name; null when omitted. |
