Skip to navigation

Get usage and cost over a date range

Returns everything a usage page needs in one answer: totals for the range, a time series in hour or day buckets, per-model figures (cost, error rate, latency, how often a call fell back to another provider and why, the share of input read from cache), per-key totals, and sandbox figures (counts by status, running time and cost per provider, GPU time per GPU class, create time).

from is included and to is excluded. Both are UTC: a date (2026-11-24) or an RFC 3339 time. Left out, the range is the 7 days that end now. With bucket=hour the range may cover 31 days, with bucket=day 366 days.

group_by splits the series by one field. totals, by_model, by_key and sandboxes do not depend on it. Sandboxes have no model. With group_by=model the series holds model calls only, and totals still includes sandboxes. With a model filter every section holds model calls only.

A key with the admin scope sees the whole account. Any other key sees its own usage only, as if key_id were set to it.

Cost fields are US dollars. See the Usage tag for what a cost is and when it is null. OpenAI’s analogue is GET /v1/organization/usage/completions with GET /v1/organization/costs, and OpenRouter’s is its Activity page.

Scope: any. Whole-account figures need admin.

Authentication

AuthorizationBearer

A Meadow API key, sent as Authorization: Bearer mdw_.... The header x-api-key: mdw_... is accepted in its place.

Query parameters

fromstringOptional

Start of the range, included. A UTC date or an RFC 3339 time. Defaults to 7 days before to.

tostringOptional
End of the range, excluded. A UTC date or an RFC 3339 time. Defaults to now.
bucketenumOptionalDefaults to day

Width of one point of series.

Allowed values:
group_byenumOptionalDefaults to none

Splits series by this field. none gives one point per bucket.

Allowed values:
project_idstringOptional
Count only this project.
key_idstringOptional

Count only this key. A key without the admin scope may pass only its own id.

providerstringOptional

Count only this provider, for example anthropic or daytona.

modelstringOptional
Count only this model, by the id Meadow sent to the provider. Leaves sandboxes out.

Response headers

x-request-idstringOptional

Meadow’s id for this request, req_ and 24 hex characters. Every response carries it, including errors, streams and unknown routes. Every error in the Error schema repeats it as request_id. Quote it when you report a problem.

Response

Usage and cost for the range.
objectenum

Always usage.

Allowed values:
fromdatetime
Start of the range that was read.
todatetime
End of the range, excluded.
bucketenum
Allowed values:
group_byenum
Allowed values:
currencystring

The currency of every cost field. Always USD.

price_versionstring
The version of Meadow's price table that is in use now. Each record keeps the version it was priced with.
totalsobject
Counts and cost for one group of records. Token sums count measured calls only. Cost fields are US dollars and leave out every record whose cost is unknown.
serieslist of objects
One point per bucket and group that has any usage, in time order. A bucket with no usage has no point.
by_modellist of objects

Per-model figures for the range, highest cost first. At most 200.

by_keylist of objects

Per-key totals for the range, highest cost first. At most 50.

sandboxesobject
Sandbox figures for the range.

Errors

400
Bad Request Error
401
Unauthorized Error
429
Too Many Requests Error
500
Internal Server Error