Usage
Per-customer spend reports and a per-request usage feed
The usage endpoints report each customer’s spend, split by whose credential served it. Use them to bill customers or reconcile your invoice.
One customer
GET /v1/customers/{customer_id}/usage takes optional inclusive start and end dates (YYYY-MM-DD), defaulting to month to date.
The three spend fields don’t overlap and sum to the customer’s total for the range.
Totals and request_count cover exactly your dates, but the per_* breakdowns use whole calendar months, so a mid-month boundary pulls in the full month and their sum can exceed the totals. Use month-aligned ranges when the two must agree.
A customer API key calling this for its own customer gets only customer_byok_spend and request_count.
All customers
GET /v1/customers/usage (organization-level key only) takes the same dates and returns one row per customer with spend in the range, highest total first. Here byok_spend combines the customer’s and your organization’s keys.
A range longer than 366 days, an invalid date, or a start after end returns 400 on both endpoints.
Per-request records
GET /v1/customers/usage/records (organization-level key only) returns one record per request served for a customer, oldest first, so you can charge each request in your own billing system. It includes requests whose response never reached you, such as a dropped connection or a stream you closed early, and video jobs: their final cost arrives as its own record, with job_id, when the job completes.
next works like every other list: it’s set while pages come back full and null once you’re caught up. To keep billing as new records arrive, store cursor, which every response returns (empty pages included), and pass it as cursor on the next poll. Records appear about 10 seconds after a request finishes. id is unique and never reused, so dedupe on it if you replay a page.
cost_usd is what Gateway charges you for the request. On your own vendor keys (credential_type byok) it’s the Gateway fee only, and provider_cost_usd is what the vendor bills you directly. A failed request appears with its status and usually a cost_usd of 0. Records are kept for at least 90 days.