Documentation
Credit and usage
View .mdOpenAPI

Get your balance and usage

GEThttps://weights.fyi/run/v1/usagescope: read
text
GET https://weights.fyi/run/v1/usage[?limit=<rows>]
GET https://weights.fyi/run/v1/usage?schema=weights.receipts/v1[&request_id=<uuid>][&after=<seq>][&through=<seq>][&limit=<n>]
Authorization: Bearer <token>                    scope: read
Available since
2026-10-08, when the service went live on weights.fyi/run.
Answer time
synchronous: the answer is read from your account's records at once.

Tells you where your money stands and what you bought: your balance, what you can spend now, each recent page job's pages and cost, each fine-tune's training tokens and cost, each LLM endpoint's tokens and charges, the charges of every UTC day by unit, the credit that came in, and payment pages you have not paid. available_usd_micros is what new work is admitted against and what the 402 refusals quote; a job that finds it at zero while running does not fail but waits, waiting_for: "credit", until credit arrives.

Every charge is posted as the work lands, at the price per 1M units the work was admitted at: pages per batch of results, a chat call when it ends with its answer, a fine-tune as it trains. A job's cost is the sum of its charges, final once the job has ended. How the prices are set: Prices and billing. Every row as one file: GET /v1/usage.csv. With ?schema=weights.receipts/v1 the call answers usage receipts instead: one per settled request, looked up by request_id or read in order.

Request

NameWhereRequiredMeaning
AuthorizationheaderyesBearer and a token that holds the read scope.
limitquerynoHow many rows each list holds at most, newest first: 1 to 1,000, which is also the default. With schema: receipts a page, 1 to 1000, default 100.
schemaquerynoweights.receipts/v1 answers usage receipts instead of the figures below. Any other value is ignored.
request_idquerynoWith schema: the one receipt of this request, a UUID (the X-Request-Id of the call).
afterquerynoWith schema: list receipts whose receipt_seq is above this; default 0. Pass the last page's next.
throughquerynoWith schema: list receipts up to and including this receipt_seq; default your account's latest. Send the first page's through again to read one fixed window.

Return value

200 OK with your account's figures.

FieldMeaning
balance_usd_microsYour credit after every charge, in micro-dollars.
in_progress_usd_microsCharges not yet posted; 0, since charges post as the work lands.
available_usd_microsWhat you can spend now. New work is admitted against this figure.
jobsYour most recent page jobs, newest first: job_id, model, created_at, status, pages, pages_done, pages_counted (the pages charged), cost_usd_micros, final and prices (usd_per_1m_pages, the price it was admitted at).
fine_tunesYour most recent fine-tunes the same way, with training_tokens (the tokens trained and charged) in place of pages, and prices.usd_per_1m_training_tokens.
endpointsYour LLM endpoints: id, model, requests, by_outcome, prompt_tokens (cached included), cached_tokens, completion_tokens, charges_usd_micros (by part: prompt, cached, output), usd_micros and final (no call in flight).
daysPer UTC day, newest first: day, usd_micros, and per unit chat (requests and tokens), pages and training (training tokens), each with its usd_micros.
other_chargesCharges that belong to no unit: the Tracing and tracking fee, and charges by run of the model made before prices per unit; each with at, usd_micros and what.
creditsCredit added, granted or refunded, newest first, each with at, usd_micros, kind (topup, grant or refund) and what.
pending_topupsPayment pages you opened and did not pay yet: topup_id, usd_micros, created_at, state (awaiting_payment).
noteOne sentence on how a charge is counted.

A job admitted before prices per unit has cost_usd_micros: null: its cost is among the earlier charges by run.

With schema=weights.receipts/v1, 200 OK is a page of receipts, oldest first, or the one receipt request_id names. Amounts and sequence numbers are whole numbers written as text.

FieldMeaning
schemaweights.receipts/v1 on the page and on a lookup; weights.billed-usage/v1 on each receipt in a page.
receiptsThe page: each with request_id, receipt_id, receipt_seq, state (settled), model, usage (the units billed, such as prompt_tokens and completion_tokens), amount_usd_micros, computed_usd_micros, parts_usd_micros, cap_reason, terminal_status, recovered and settled_at; a plan's work also carries compute_plan.
after, throughThe window this page was read from.
nextThe after of the next page: the last listed receipt_seq, or this page's after when it is empty.
has_moretrue while receipts remain up to through.
state (lookup)settled with the receipt's fields; pending for a request admitted and not yet settled; unknown for a request your account never made. The last two carry no amounts.

Errors

StatusCodeWhen it happensWhat to do
400invalid_parameter, parameter_out_of_rangelimit is not a whole number, or not between low and high.Stay inside them.
400invalid_request_idWith schema: request_id is not a UUID.Send the request's UUID.
400invalid_receipt_windowWith schema: after, through or limit is not a whole number, limit is outside 1 to 1000, through is below after, or through is above your account's latest receipt.Start from after=0 and reuse the through and next an answer gave.
503receipt_authority_unavailableWith schema: this service keeps no receipts.Use the figures without schema.
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.

Examples

From a test copy of the service on 2026-10-10, after one page job of 5 pages:

sh
curl -s https://weights.fyi/run/v1/usage -H "Authorization: Bearer $WEIGHTS_API_KEY"
json
{
  "balance_usd_micros": 24999989,
  "in_progress_usd_micros": 0,
  "available_usd_micros": 24999989,
  "endpoints": [],
  "jobs": [
    {"job_id": "job_5e7c50ca2489d324a215b0ba", "created_at": "2026-10-10T08:28:09.800Z", "status": "SUCCEEDED",
     "cost_usd_micros": 11, "final": true, "prices": {"usd_per_1m_pages": 2.288525}, "model": "laya-page-role",
     "pages": 5, "pages_done": 5, "pages_counted": 5}
  ],
  "fine_tunes": [],
  "days": [{"day": "2026-10-10", "usd_micros": 11, "pages": {"pages": 5, "usd_micros": 11}}],
  "other_charges": [],
  "credits": [{"at": "2026-10-10T08:28:09.774Z", "usd_micros": 25000000, "kind": "grant", "what": "Credit granted"}],
  "pending_topups": [],
  "note": "Charged per unit as your work lands: prompt, cached and output tokens per call, pages answered, training tokens trained, each at the price per 1M units it was admitted at. Never a start, a wait or a move."
}

A page of receipts (?schema=weights.receipts/v1&after=40), abridged:

json
{"schema": "weights.receipts/v1", "after": "40", "through": "41", "next": "41", "has_more": false,
 "receipts": [{"schema": "weights.billed-usage/v1", "request_id": "3f2b8c1e-9a4d-4e7b-8c21-5d6f7a8b9c0d",
               "receipt_seq": "41", "state": "settled", "currency": "USD", "model": "qwen3.8-27b",
               "usage": {"prompt_tokens": 27, "completion_tokens": 64}, "amount_usd_micros": "18",
               "computed_usd_micros": "18", "cap_reason": null, "terminal_status": "completed",
               "recovered": false, "settled_at": "2026-11-16T09:30:02.114Z"}]}

Patterns

Waiting for a payment

After POST /v1/credit/topups, poll every few seconds until the topup_id leaves pending_topups and a "Credit added" row is in credits; then available_usd_micros includes it.

History

  • 2026-10-08: live, usage per job rather than per run; pending_topups and "Credit added" with card payments; option fees under other_charges with the Tracing and tracking option.
  • 2026-10-09: pages_counted and usd_per_1000_pages per job, endpoints with their tokens and usd_per_1m_output_tokens, and per_unit_basis.
  • 2026-10-10: charges per unit as the work lands: prices per job, fine_tunes with their training tokens, the endpoints' cached tokens and charges by part, days; the per-unit figures worked out from a run's charge are gone.
  • 2026-11-16: the receipts view, ?schema=weights.receipts/v1, documented here.

See also

GET /v1/jobs/{job_id}, Prices and billing, Tracing and exports for how receipts relate to traces and plan events.