Skip to navigation

Get Organization Usage

Organization-wide spend for a date range: totals by day, a per-model breakdown by month, and optionally a breakdown by project, API key or vendor.

Authentication

AuthorizationBearer

A management key (mgmt_...), sent as Authorization: Bearer <key>. Reading /v1/routing-policies also accepts the organization’s gateway API keys; writing there needs a management key.

Query parameters

startstring or nullOptional

First day of the range, YYYY-MM-DD, inclusive. Defaults to the 1st of this month.

endstring or nullOptional

Last day of the range, YYYY-MM-DD, inclusive. Defaults to today.

group_byenum or nullOptional
Also break spend down by project, API key or vendor.
Allowed values:

Response

The organization's spend and usage for the range
byok_spenddouble

Spend on your own provider credentials (BYOK), at list price, USD.

endstring

Last day of the range, inclusive, YYYY-MM-DD.

merge_hosted_spenddouble

Spend on Merge-managed credentials, USD.

model_spendmap from strings to doubles

Spend in USD per provider/model, with BYOK spend at list price. Covers the whole months the range overlaps.

model_spend_granularity"month"

model_spend and vendors cover the whole months overlapping start to end.

request_countinteger
Number of requests.
startstring

First day of the range, YYYY-MM-DD.

total_spenddouble
All spend, USD.
web_search_spenddouble

Server-side web search cost, USD.

api_keyslist of objectsOptional

Spend per API key. Present with group_by=api_key.

projectslist of objectsOptional

Spend per project. Present with group_by=project.

vendorsmap from strings to doublesOptional

Spend in USD per serving vendor, by month like model_spend. Present with group_by=vendor.

Errors

401
Unauthorized Error
403
Forbidden Error
422
Unprocessable Entity Error