Get AI spend
AI spend for a period, by invoicer, vendor, model or cost center.
GET/v1/workspaces/{regionId}/ai-spend
Parameters
periodstringThe month, YYYY-MM. Defaults to the current month.
groupBy"invoicer" | "vendor" | "model" | "costCenter"What each group is. Defaults to invoicer, which matches your invoices. vendor sums one model vendor across invoicers (what you spend on Claude, wherever it is billed), model one model id as billed, costCenter the attribution rules' cost centers.
Returns
200 OK with the object shown in the response.
More details
For a period (by default the current month), the AI spend of every connected invoicer, grouped as groupBy says: month to date, the forecast for the whole period, the last closed month and the change against it, with the usage by meter, and beside each invoicer the open purchase order lines raised to it and what is left on them. The figures are the AI lines the connections synced (daily for current_cost, as the month-to-date cost today). An invoicer whose connection reads only invoices shows the closed month: its month to date and forecast are absent (an AWS account that reads only invoices has no AI lines and is listed in notReadable). The forecast is the provider's where it gives one (AWS Cost Explorer), otherwise linear on the days elapsed. Amounts are in each invoicer's billing currency, and totals are one entry per currency, never summed across currencies. Grouping by costCenter follows the attribution rules (GetAiAttribution); a line no rule matches is unattributed.
Response fields
periodstringThe month the figures are for, YYYY-MM.
asOfstringWhen the newest line was synced, ISO 8601. The month to date is as of then, not now.
totalsArray<object>One entry per billing currency, never summed across currencies: monthToDate, forecast for the whole period, lastMonth (the last closed month) and changePct, the forecast's change against lastMonth in percent.
groups[].keystringAs groupBy says: the invoicer's cloud connection id; the vendor (anthropic, openai, google, meta, mistral, amazon, microsoft, cohere, xai, deepseek or unknown for a usage type Pleaxy hasn't mapped yet); the model id as billed, e.g. claude-sonnet-4-5 or gemini-2.5-pro; or the cost center's code.
groups[].labelstringWhat to show for the group: the connection's account label, the vendor's name, the model's name or the cost center's name.
groups[].invoicerstringWho bills the group's spend, a cloud or an AI provider, with invoicerId its connection: always with groupBy invoicer, and for a vendor or model group when a single connection bills all of it (Claude only through Bedrock, say); absent when several do. A cost center group never has one.
groups[].monthToDatenumberIn the group's currency, with forecast, lastMonth and changePct as in totals. monthToDate and forecast are absent for an invoicer whose connection reads only invoices: it shows lastMonth only.
groups[].quantitiesArray<object>The usage by meter. Token-metered lines: input_tokens, output_tokens, cached_input_tokens, cache_write_tokens, batch_input_tokens, batch_output_tokens, images, audio_seconds, embeddings_tokens or requests. Capacity lines: gpu_hours, ptu_hours, model_units_hours or cluster_hours. other for a line Pleaxy hasn't mapped to a meter yet. unit is the quantity's unit: 1M_tokens, tokens, requests, images, seconds, gpu_hours, ptu_hours, model_unit_hours, or units for an unmapped line.
groups[].purchaseOrdersArray<object>The open purchase order lines raised to the group's invoicer, with what is left on each (remaining, in the group's currency) after the invoices already drawn on it. Only for a group with an invoicer.
groups[].servicesArray<object>Only with groupBy invoicer: the group's figures by the provider's own service (Amazon Bedrock, with the marketplace models it bills; Amazon SageMaker; Vertex AI; ...), as the Spend page's Cloud tab shows them.
unattributedArray<object>Only with groupBy costCenter: the spend no attribution rule matched, one entry per currency in a group's shape, shown and never hidden. Write a rule for it with SetAiAttribution.
notReadableArray<object>Connected accounts with no AI lines, and why: needs_current_cost for an AWS account whose connection doesn't allow current cost (AWS gives its AI lines through Cost Explorer only), not_synced_yet for one whose AI lines haven't been read yet. Absent when there are none.
Errors
- 400 Bad Request - period isn't a month as YYYY-MM, or groupBy isn't invoicer, vendor, model or costCenter.
- 401 Unauthorized - No credential was presented, or the Bearer token / X-Api-Key value is missing, invalid, expired, or revoked.
- 403 Forbidden - The caller's Bearer token or API key doesn't grant access to this workspace (regionId), or lacks the required role.
GET /v1/workspaces/reg_01k5x8p9j3q7vn2mhb4tzc6rde.buyer/ai-spend?period=2026-10&groupBy=vendor{
"period": "2026-10",
"asOf": "2026-10-29T06:10:00.000Z",
"totals": [
{ "currency": "USD", "monthToDate": 57280.14, "forecast": 61400, "lastMonth": 48930.55, "changePct": 25.5 }
],
"groups": [
{
"key": "anthropic",
"label": "Anthropic",
"invoicer": "aws",
"invoicerId": "conn_01k7q2n4m8b3xd5fwj9hz6rsvt",
"currency": "USD",
"monthToDate": 44612.3,
"forecast": 47830,
"lastMonth": 38104.2,
"changePct": 25.5,
"quantities": [
{ "meter": "input_tokens", "unit": "1M_tokens", "quantity": 7120.4 },
{ "meter": "output_tokens", "unit": "1M_tokens", "quantity": 918.3 },
{ "meter": "cached_input_tokens", "unit": "1M_tokens", "quantity": 15480 },
{ "meter": "cache_write_tokens", "unit": "1M_tokens", "quantity": 1288.7 }
],
"purchaseOrders": [ { "poId": "PO-8842", "lineNo": 1, "remaining": 4200 } ]
},
{
"key": "amazon",
"label": "Amazon",
"invoicer": "aws",
"invoicerId": "conn_01k7q2n4m8b3xd5fwj9hz6rsvt",
"currency": "USD",
"monthToDate": 12667.84,
"forecast": 13570,
"lastMonth": 10826.35,
"changePct": 25.3,
"quantities": [
{ "meter": "input_tokens", "unit": "1M_tokens", "quantity": 10874.8 },
{ "meter": "output_tokens", "unit": "1M_tokens", "quantity": 1240 }
],
"purchaseOrders": [ { "poId": "PO-8842", "lineNo": 1, "remaining": 4200 } ]
}
]
}