Get workspace usage over time
Returns billed usage for the workspace the API key belongs to, split into time buckets and grouped by model, endpoint, or product. Use it to reconcile spend, attribute cost across models, or feed an internal cost report.
Units. cost_micros and spend_micros are millionths of a US dollar,
so divide by 1,000,000 to get dollars. The fields under summary.balance
are the exception: despite their _micros suffix they are cents, so
divide those by 100.
Freshness. Figures are drawn from your invoices rather than from live request traffic, so very recent usage may not appear yet. Treat this as a reporting surface, not a real-time meter.
Empty results. A workspace that has not been billed yet returns empty
groups, buckets, and breakdown arrays with a 200, not an error.
Authorizations
API key authentication. Generate an API key from your account settings at https://platform.comfy.org/profile/api-keys. Pass the key in the X-API-Key header.
Query Parameters
How to group spend within each time bucket.
model, endpoint, product Width of each time bucket.
hour, day, month Start of the range, inclusive (RFC 3339). Overrides months when set.
End of the range, exclusive (RFC 3339). Defaults to the current hour.
How many months back to report, counted from ending_before. Ignored when starting_on is set.
1 <= x <= 24Response
Success - Usage returned
Billed usage for one workspace over a time range.
How spend was grouped, echoing the request.
model, endpoint, product Width of each bucket, echoing the request.
hour, day, month Start of the reported range, inclusive.
End of the reported range, exclusive.
Every group key present in the range, ordered by total spend, highest first. Use it to keep series in a stable order across buckets.
One entry per group per time bucket, oldest bucket first. A group with no spend in a bucket is omitted rather than reported as zero.
Total spend per group across the whole range.