Public Get Billing Spend
Changed onSpend and usage by UTC day and by model (TRA-1193).
The response covers every request the team sent through the gateway between start and end, priced at the team's rates. Each day and each model carries request and token counts alongside its cost_usd. The window is half-open (end is excluded). It may cover at most 31 days, one calendar month, and it may not start before the year of usage the gateway keeps.
model narrows both breakdowns to one slug. The gateway groups usage by the model it routed to, so the slug to send is one the models list names. Traffic sent under an alias of that model is counted with it, and a filter on the alias itself finds nothing. A request that a fallback model answered stays under the model you called, priced at the fallback model's own rates, which is how it is invoiced.
prompt_tokens includes cached_prompt_tokens, and the gateway prices the difference as fresh input. These are the Billing page's figures, built the way the invoice is: token models at your rates, and a dedicated GPU model at each day's invoice figure (the monthly base prorated by day plus overage GPU-minutes). Models you pay a provider for directly are not priced, and a GPU day the nightly billing cycle has not recorded yet (today) is not priced either; both show as requests outside priced_request_count.
Request
- Base URLhttps://api.trainloop.ai (the document declares no server; this is the origin it was published from)
- Authnone declared
Query parameters
The first UTC day of the window. The default is 30 days before end.
The first UTC day after the window. The default is tomorrow, which puts today inside the window.
One model slug, as the /v1/billing/spend models list names it. The default is every model.
Headers
Response
Successful Response
Changes
- info
endpoint added
- info