The usage API is read-only. It returns the requests, tokens and cost that the Usage and Cost pages show, so a script, a dashboard or a billing job can read the same figures. It never changes a project, a key or a limit.
The usage API is served by the Hollow API gateway at https://api.projecthollow.com. That is a different address from the model API (https://models.projecthollow.com): send usage requests to the gateway and model requests to the model API.
Send the key as a Bearer token in the Authorization header, as for the model API. The gateway reads no other header.
Authorization: Bearer hlw_sk_...The key needs the platform:read scope (Read usage and cost). On the Keys page, choose New API key, then under More access levels choose Read usage and cost. A key with only this scope cannot call a model, so keep it apart from the key your application uses for models. A model key does not carry the scope and cannot read usage. The same gateway also runs workflows, with a separate platform:run scope: see Run workflows over the API. Spend by workflow agent steps appears in these figures under the key that started the run.
- A key belongs to the project it was made in, which is the default project when none was named, and it can read that project only. Its projects list holds that project alone, and usage, cost and CSV reads are limited to it whether or not you pass
projectId. - Passing the
projectIdof any other project is refused with HTTP 403 and the codeFORBIDDEN. Nothing is returned. - A key that belongs to no project, such as one from before projects existed or one made by signing in with the Hollow CLI, reads every project on the account, and
projectIdnarrows the read to one of them. AprojectIdthat is not on the account is a 404.
{
"error": {
"code": "FORBIDDEN",
"status": 403,
"message": "This API key is bound to a different project."
}
}| Method and path | Returns |
|---|---|
GET /v1/platform/projects | The projects the key can read: id, name, status and limits. |
GET /v1/platform/usage | Rows of requests and tokens, with totals and freshness. |
GET /v1/platform/costs | The same rows with cost in pounds, the currency and the pricing version. |
GET /v1/platform/usage.csv | Every row of a usage read as CSV. |
Usage, costs and the CSV take the query parameters below. The projects endpoint takes none.
| Parameter | Required | Default | What it does |
|---|---|---|---|
from | Yes | None | The start of the range, a UTC time ending in Z, such as 2026-10-01T00:00:00Z. |
to | Yes | None | The end of the range, in the same form. It must be after from and not in the future, and the range can span at most 400 days. |
projectId | No | All readable projects | Only this project. A key bound to a project always reads that project. |
apiKeyId | No | All keys | Only this key. Use the apiKeyId of a row. |
model | No | All models | Only this model id. |
groupBy | No | day | How rows are grouped: day, model, key, project, day_model, day_key or cell (day, project, key and model together). |
bucket | No | day | day or hour. hour reads hourly totals for the last 7 days only; see Hourly usage below. |
pageSize | No | 50 | Rows per page, from 1 to 200. |
pageToken | No | First page | The nextPageToken of the previous response. |
Usage is totalled per UTC day, so from and to select whole days: a range that starts or ends part-way through a day includes all of that day. Rows are never finer than a day unless you ask for bucket=hour, and daily totals are kept for 400 days.
Add bucket=hour to read per UTC hour. Hourly totals are recorded from the day hourly recording was switched on and are not backfilled, so an hour before that is absent, which is not the same as no usage. A read covers at most the last 7 days (from no earlier than that), and from and to select whole hours. Hourly totals are kept for 35 days.
- With
bucket=hourthe groupings that name a day (day,day_model,day_keyandcell) give one row per hour, andbucketStartis the start of that hour. The other groupings add up the whole range. coverageStartis the start of the first hour recorded for the account. A range that starts earlier covers time that cannot be shown.- Hourly reads are bounded: a read that matches more than 5,000 hourly records is refused with HTTP 400. Name a
projectIdor choose a shorter range. - Daily and hourly figures describe the same requests, but a day before hourly recording began has no hours, so the days can total more than the hours shown.
curl 'https://api.projecthollow.com/v1/platform/costs?from=2026-10-01T00:00:00Z&to=2026-10-18T00:00:00Z&groupBy=model' \
-H "Authorization: Bearer $HOLLOW_API_KEY"import os
import requests
response = requests.get(
"https://api.projecthollow.com/v1/platform/costs",
headers={"Authorization": f"Bearer {os.environ['HOLLOW_API_KEY']}"},
params={"from": "2026-10-01T00:00:00Z", "to": "2026-10-18T00:00:00Z", "groupBy": "model"},
timeout=30,
)
response.raise_for_status()
print(response.json()["totals"]["costGbp"])A usage read returns rows, totals and freshness, and a cost read adds currency and pricingVersion. Each response can also carry coverageStart and nextPageToken.
| Field | Meaning |
|---|---|
key | The group the row stands for: a day, a model id, a key id or a project id, as groupBy says. |
projectId, apiKeyId, model | The dimensions the row is grouped by. A dimension the grouping does not use is null. apiKeyId is also null for usage with no key. |
bucketStart | The start of the UTC day (or of the UTC hour, with bucket=hour), for a grouping by day. Otherwise null. |
inputTokens, outputTokens | Tokens sent and received. inputTokens is the input that was not read from the cache. |
cacheReadTokens, cacheWriteTokens | Input read from, and written to, the provider cache. They are counted apart from inputTokens. |
calls | The number of requests. |
costGbp | The charge in pounds sterling, to nine decimal places. It is a number, not a formatted string. |
status | settled for a final figure. partial when some requests in the row had no price, so the cost is not complete. unknown when some could not be measured, so the figure must not be treated as final. |
totalsadds up every matching row, not only the page you received, so a total never depends onpageSize.currencyis alwaysGBP.pricingVersionnames the price list the cost was calculated with (2026-10-30in the example).- Cost is what the request charged to your prepaid credit. A request with no price adds nothing to
costGbpand turns its rowpartial, so a missing price is never shown as spend. - Rows grouped by day are in date order. Every other grouping lists the most expensive first.
- Usage that happened before attribution began is not in the figures.
coverageStartis the first day the account has attributed usage, and a range that starts earlier covers history that cannot be shown.
{
"rows": [
{
"key": "example-model",
"projectId": null,
"apiKeyId": null,
"model": "example-model",
"bucketStart": null,
"inputTokens": 1820400,
"outputTokens": 412900,
"cacheReadTokens": 96000,
"cacheWriteTokens": 0,
"calls": 1284,
"costGbp": 3.482117,
"status": "settled"
}
],
"totals": {
"inputTokens": 1820400,
"outputTokens": 412900,
"cacheReadTokens": 96000,
"cacheWriteTokens": 0,
"calls": 1284,
"costGbp": 3.482117
},
"currency": "GBP",
"pricingVersion": "2026-10-30",
"freshness": {
"asOf": "2026-10-18T09:30:12.481Z",
"freshThrough": "2026-10-18T09:29:47.903Z",
"status": "fresh"
},
"coverageStart": "2026-09-14T00:00:00.000Z"
}A response holds up to pageSize rows (50 unless you say otherwise, at most 200). While more rows remain it carries nextPageToken. Send that value back as pageToken, with every other parameter unchanged, until a response has none. Treat the token as opaque. A token the API did not give you is refused with HTTP 400.
curl 'https://api.projecthollow.com/v1/platform/usage?from=2026-10-01T00:00:00Z&to=2026-10-18T00:00:00Z&groupBy=cell&pageSize=100' \
-H "Authorization: Bearer $HOLLOW_API_KEY"
# The response ends with "nextPageToken" while more rows remain. Send it back unchanged:
curl 'https://api.projecthollow.com/v1/platform/usage?from=2026-10-01T00:00:00Z&to=2026-10-18T00:00:00Z&groupBy=cell&pageSize=100&pageToken=TOKEN_FROM_THE_LAST_RESPONSE' \
-H "Authorization: Bearer $HOLLOW_API_KEY"Usage that arrives while you page can move rows between pages, so for an exact total read totals from the first page.
GET /v1/platform/usage.csv takes the same parameters and returns the whole result in one response as text/csv, with CRLF line endings. It ignores pageToken and returns every row; pageSize is still checked, so a value outside its range is refused. The header is:
bucketStart,projectId,apiKeyId,model,inputTokens,outputTokens,cacheReadTokens,cacheWriteTokens,calls,costGbp,statusA value that starts with =, +, - or @ gets a leading apostrophe, so a spreadsheet reads it as text and never as a formula. A read that matches more than 10,000 daily records is refused with HTTP 400: choose a shorter range.
- A request is recorded when its cost is settled, which happens as the model finishes and its usage is known. It is written in the same step as the cost, so a request is not counted without its cost or the other way round. Refused requests, and requests that produce no usage, are not counted. Playground requests are.
- A settlement that cannot be written straight away is retried in the background. A retry sweep runs every 10 minutes, and a settlement that keeps failing waits longer between tries, up to six hours. While any is waiting, every usage and cost read of the account says
processing, because the figures may be short. After eight failed tries it is set aside for Hollow to reconcile by hand, and reads stop sayingprocessingfor it. - Every response states how current it is.
freshness.statusisfresh,processingorunavailable.unavailablemeans the account has no attributed usage at all yet. It is not zero, androwsis empty. freshness.asOfis the time of the read.freshness.freshThroughis the time of the newest settlement among the days you asked for, or the time of the read when there are none.
A failure is a JSON body with an error object holding code, status and message. The same codes apply on every endpoint.
| Situation | HTTP status | Code |
|---|---|---|
No Authorization: Bearer header, a malformed key, or a key that does not exist | 401 | MISSING_AUTH_HEADER, INVALID_KEY_FORMAT or INVALID_KEY |
| The key is disabled, deleted, suspended or expired | 401 | KEY_REVOKED, ANOMALY_SUSPENDED or KEY_EXPIRED |
The key lacks the platform:read scope | 403 | INSUFFICIENT_SCOPE |
| The account is not approved for Hollow | 403 | ACCOUNT_NOT_APPROVED |
A projectId other than the one the key is bound to | 403 | FORBIDDEN |
A missing or invalid parameter, to before from, a future to, a range over 400 days, bucket=hour over a range that starts more than 7 days ago, a bad pageToken, or too many records in the range | 400 | INVALID_REQUEST |
A projectId that is not on the account | 404 | NOT_FOUND |
| More than 600 requests a minute from one key | 429 | RATE_LIMITED |
| The service is busy | 503 | UNAVAILABLE |
The model API reports its own failures differently. See Errors and status codes for those, and Authentication for keys, scopes and expiry.