Metering headers
You attach tags to a request using three optional HTTP headers. All three are stripped by Tokonomics before the request is forwarded to the provider, so they never appear in your provider logs.X-Metering-Tags
A JSON object of arbitrary key-value pairs. Use this header when you want to attach multiple dimensions to a single request.
X-Feature-Name
A shorthand header for tagging a single feature. Tokonomics stores the value as {"feature": "<value>"} on the UsageEvent. Use this header when X-Metering-Tags would be redundant for simple per-feature attribution.
X-Tenant-ID
Identifies the end-customer on whose behalf the call is made. Tokonomics stores the value as {"tenant_id": "<value>"} on the UsageEvent, enabling per-customer cost breakdowns.
Examples
Querying by tag
Once your requests are tagged, you can break down spend by any tag key using the Analytics by Tag endpoint:team tag. You can scope the result to a time period using the period query parameter:
For example,
GET /analytics/by-tag?key=feature&period=quarter returns per-feature spend for the current quarter. See the full endpoint reference at Analytics by Tag.
Best practices
What tag keys should I use?
What tag keys should I use?
There are no reserved tag keys. A useful starting set covers the dimensions you already report on:
team— the engineering or business team responsible for the featurefeature— the product feature making the LLM callenv—production,staging, ordevelopmenttenant_id— your customer’s identifier for multi-tenant appsproduct— the top-level product area, useful when multiple teams share one account
team vs Team vs squad) will produce separate buckets in analytics.