v6

latestOpenAPI 3.1.0raw.githubusercontent.com2026-08-01485121699.8 KB

Get Costs By Tag

Aggregate cost data grouped by allocation tag or by adapter.

The endpoint serves three callers:

  • Web GUI (Costs.tsx adapter table) - calls GET /costs/by-tag and expects an array of {adapter, calls, tokens, cost_usd, share_pct, delta_7d_pct} rows. With shape=auto (default) and no tag_key, this is what we return.
  • Legacy callers passing tag_key=… - receive the existing {by_tag: {key: {value: cost}}} envelope.
  • Legacy callers wanting the envelope explicitly - pass shape=tags and get the envelope without supplying a key.

The hours parameter controls the GUI window (default 24h).

get/costs/by-tag

Query parameters

tag_keystring nullable
hoursinteger
shapestring

Response

Successful Response

{"stackTrail":"paths:/costs/by-tag:get:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}