Documentation
Credit and usage
View .mdOpenAPI

Download every credit and charge as CSV

GEThttps://weights.fyi/run/v1/usage.csvscope: read
text
GET https://weights.fyi/run/v1/usage.csv
Authorization: Bearer <token>                    scope: read
Available since
2026-10-08, with the exports, built on the evening the service went live.
Answer time
streamed: the first rows arrive at once and the file is written as it is read, however long your account's history is.

Downloads every credit and every charge of your account, oldest first, as one CSV file. It is the record to give your bookkeeping, or to reconcile against your own: each row is one line of your account's ledger, with its amount exact to the micro-dollar, what it was in words, and for a charge, the jobs it covers.

Where GET /v1/usage shows your recent jobs with their cost, this file shows the ledger itself: one charge row per batch of pages answered, per chat call and per stretch of training, written as the work lands, its what naming the unit, the model and the units, its last column the job. A job's own cost is the sum of its charge rows. Rows written before prices per unit are charges by run of the model. The file has no row limit and is not cut into pages: the service writes it as it reads your ledger, 1,000 rows at a time, so the download costs the same however long your history is. It is sent with chunked transfer encoding and a Content-Disposition that names it usage.csv, so a browser saves it as a file. If the download is interrupted, the file ends without the closing chunk, and your client reports an incomplete answer rather than a short file that looks whole; download it again.

Request

NameWhereRequiredMeaning
AuthorizationheaderyesBearer and a token that holds the read scope.

The call takes no parameters.

Return value

The columns, in order:

ColumnMeaning
idThe ledger row's number. Rows are written in this order and never change.
timeWhen the row was written, UTC.
kindtopup (credit you paid for), grant (credit we granted), refund, charge (a charge for work) or option (the fee of an option such as Tracing and tracking).
whatThe same in words: "Credit added", "Credit granted", "Refund", for a charge the unit and its count ("Pages answered, laya-page-role: 64"; "Chat call, ..."; "Training tokens, ..."), or the option's name.
amount_usdThe amount in dollars with six decimals; credit is positive and charges are negative.
amount_usd_microsThe same amount as a whole number of micro-dollars.
jobsFor a charge or an option fee, the jobs it covers, separated by spaces; empty for credit.

200 OK with a CSV file, text/csv; charset=utf-8: a header line with the seven column names above, then one line per ledger row, oldest first. Lines end in CRLF, as CSV files do. The answer carries Content-Disposition: attachment; filename="usage.csv" and Transfer-Encoding: chunked.

Errors

StatusCodeWhen it happensWhat to do
401unauthorized, invalid_token, token_revoked, token_expiredNo token, or one that does not work (any more).Use a valid token.
403scope_required, account_suspendedThe token lacks read, or the account is suspended.Use a token with read.

A failure once the file has started cannot be a JSON error any more; it shows as an answer that ends early, as described above.

Examples

sh
curl -s -o usage.csv https://weights.fyi/run/v1/usage.csv -H "Authorization: Bearer $WEIGHTS_API_KEY"

The file of an account that was granted $25 and has not been charged yet:

text
id,time,kind,what,amount_usd,amount_usd_micros,jobs
1,2026-10-09T08:28:09.774Z,grant,Credit granted,25.000000,25000000,

History

  • 2026-10-08: added with the exports and the Tracing and tracking option.
  • 2026-10-10: a charge row per batch of pages, chat call or stretch of training, as the work lands.

See also