Retrieve your workspace’s usage and cost for a time window — the same per-request-type breakdown shown in the dashboard, available with your API key. Use it to reconcile billing or power an internal usage dashboard.
Usage is aggregated across every Environment in the workspace; it is not scoped to a single Environment or API key.
Choosing a Window
Set the window with a period (trailing days, 1–365, default 30) or an explicit from/to range — never both. from and to are inclusive, must be sent together with from no later than to or today, and can span at most 365 days. Set them to the same day to read a single day’s usage.
Cost
Each request type returns a count and a cost_micros.
Next Steps
Submit Events that this usage counts.
See how each checked Event maps to a request type.
Authorizations
Headers
Query Parameters
periodinteger<int32> | nullTrailing window in days (1–365). Mutually exclusive with
from/to. Defaults to 30.Required range:
1 <= x <= 365fromstring<date> | nullInclusive start day (YYYY-MM-DD). Requires
to. Mutually exclusive withperiod.tostring<date> | nullInclusive end day (YYYY-MM-DD). Requires
from. Mutually exclusive withperiod.
Response
Success
fromstring<date>requiredInclusive first day covered (YYYY-MM-DD).
tostring<date>requiredInclusive last day covered (YYYY-MM-DD).
messageobjectrequiredartifactobjectrequiredShow child attributesHide child attributes
toolobjectrequiredagentobjectrequiredfunctionobjectrequiredreasoningobjectrequiredtotal_microsinteger<int64>requiredTotal cost across all categories, in millionths of one USD.
Bad Request