Skip to main content
The by-tag endpoint lets you slice your AI spend by any custom dimension you’ve been tracking with the X-Metering-Tags header. Pass a tag key — such as team, feature, or tenant_id — and get back a ranked breakdown of spend and request counts per tag value for the chosen period. Use this to run internal chargebacks, understand which product features are driving costs, or monitor per-tenant consumption. Endpoint

Query Parameters

string
required
The tag key to group results by. This must match a key you’ve been setting in the X-Metering-Tags request header on your proxied calls.Common values: team, feature, tenant_id
string
default:"month"
The time period to aggregate spend over. Must be one of:

Response Fields

string
The tag key that was used to group the results. Mirrors the key query parameter. Example: "team"
string
The aggregation period that was used. Mirrors the period query parameter. Example: "month"
array
An array of spend groups, one per distinct tag value, sorted by spend descending.
Tag-based analytics require you to set tags on your proxy requests using the X-Metering-Tags header. Requests made without tags will not appear in any by-tag breakdown.

Example