Skip to content

Commit dd53924

Browse files
lohnimclaude
andauthored
docs(cli): document usage commands (#1408)
* docs(usage-api): add Usage API reference under the Admin API section Vendors the Usage API OpenAPI spec (GET /v1/usage/summary, POST /v1/usage/time-series) into src/openapi/usage-api and wires it into the Admin API nav section as "Usage API Endpoints", mirroring how the Admin API ("Apps API") endpoints are surfaced. The spec is vendored locally for now because usage-api.alchemy.com is not yet serving its /openapi.yaml publicly; once it is, this can switch to a content/remote-specs.json entry (like admin-api) for auto-sync. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs(usage-api): use admin-api.alchemy.com as the server The Usage API is path-routed (`/v1/usage*`) through the Apps API ALB at admin-api.alchemy.com (see terraform aws_alb_listener_rule.admin_api_usage), not served directly at usage-api.alchemy.com. Match the public host (and the sibling admin-api spec's server) so the reference shows the correct base URL. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs(usage-api): use remote spec instead of vendored copy Per the sync-docs-as-code pattern, register the Usage API spec as a remote entry (served at https://admin-api.alchemy.com/v1/usage/openapi.json) and remove the vendored src/openapi/usage-api/ copy. content/docs.yml already references api-name: usage-api; the remote entry now supplies it. Blocked: merge only after the dashboard change serving the spec at that URL deploys (OMGWINNING/dashboard#8050) — CI lints the live URL. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs(cli): document usage commands Add a Usage (alpha) section to the Alchemy CLI reference covering `alchemy usage summary` and `alchemy usage timeseries`, including the time-series flag table for date ranges, granularity, filters, and group-by. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(cli): drop alpha framing from usage section Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 414b733 commit dd53924

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

content/docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ navigation:
125125
- api: Admin API Endpoints
126126
api-name: admin-api
127127
flattened: true
128+
- api: Usage API Endpoints
129+
api-name: usage-api
130+
flattened: true
128131
- section: Activity Log
129132
hidden: true
130133
contents:

content/remote-specs.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
"name": "admin-api",
44
"url": "https://admin-api.alchemy.com/openapi.yaml"
55
},
6+
{
7+
"name": "usage-api",
8+
"url": "https://admin-api.alchemy.com/v1/usage/openapi.json"
9+
},
610
{
711
"name": "wallet-api",
812
"url": "https://txe-api-specs.docs.alchemy.com/wallet/openrpc.yaml",

content/tutorials/build-with-ai/alchemy-cli.mdx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,40 @@ The CLI uses your browser login automatically for Admin API commands. It also ca
269269
| `alchemy app select [id]` | Select an app to use as the default for subsequent commands |
270270
| `alchemy app chains` | List Admin API chain identifiers (e.g. `ETH_MAINNET`) for app configuration |
271271
272+
### Usage
273+
274+
The `usage` commands use your browser login automatically, like the Admin API commands above. Track and visualize your account's API usage with summaries and time-series reports.
275+
276+
| Command | Description |
277+
|---|---|
278+
| `alchemy usage summary` | Get an account usage summary |
279+
| `alchemy usage timeseries` | Get account usage time-series data. Alias: `time-series`. |
280+
281+
```bash
282+
alchemy --json usage summary
283+
alchemy usage timeseries --start-date 2026-06-01 --granularity day
284+
alchemy usage timeseries --start-date 2026-06-01 --group-by network --metrics usd
285+
```
286+
287+
`timeseries` accepts a date or time range, optional filters, and a single group-by dimension.
288+
289+
| Flag | Description |
290+
|---|---|
291+
| `--start-date <date>` | Start date (`YYYY-MM-DD`). Required unless `--start-time` is set. |
292+
| `--end-date <date>` | End date (`YYYY-MM-DD`). Defaults to now. |
293+
| `--start-time <datetime>` | Start time as an ISO datetime with a timezone |
294+
| `--end-time <datetime>` | End time as an ISO datetime with a timezone |
295+
| `--granularity <granularity>` | `hour` or `day` (default `day`) |
296+
| `--products <products>` | Comma-separated billing product names |
297+
| `--metrics <metrics>` | Comma-separated metrics: `amount`, `usd` |
298+
| `--app-ids <ids>` | Filter by app IDs (comma-separated) |
299+
| `--networks <networks>` | Filter by networks (comma-separated), e.g. `eth-mainnet,base-mainnet` |
300+
| `--methods <methods>` | Filter by methods (comma-separated), e.g. `eth_getLogs` |
301+
| `--request-types <types>` | Filter by request types (comma-separated): `http`, `websocket`, `webhook`, `grpc` |
302+
| `--group-by <dimension>` | Group by one dimension: `requestType`, `app`, `network`, `method` |
303+
304+
Filters are optional and combined with AND. `--group-by` accepts at most one dimension.
305+
272306
### Auth and config
273307
274308
| Command | Description |

0 commit comments

Comments
 (0)