Tagging a request
Add one or more of the following headers to any request you send through Tokonomics. You can mix and match them on the same request.cURL
Querying spend by tag
Use theGET /analytics/by-tag endpoint to retrieve spend aggregated by any tag key. Specify the key you want to group by and the time period.
cURL
team with any key you use in X-Metering-Tags, or with the reserved keys feature_name (populated by X-Feature-Name) and tenant_id (populated by X-Tenant-ID).
Supported period values are day, week, month, and custom (combine with start and end query parameters in ISO 8601 format).
Multi-tenant billing
If you build a product where each of your customers triggers LLM calls, setX-Tenant-ID to that customer’s unique identifier on every request. Tokonomics tracks cost and usage per tenant automatically.
To retrieve a per-tenant breakdown, query:
cURL
X-Tenant-ID values are stored as-is. Use a stable, opaque identifier — such as your internal customer UUID — rather than a mutable value like a company name.Common tag schemas
By team
By team
Tag requests with the team responsible for that feature or service. This gives you a clear per-team spend breakdown each month.
By feature
By feature
Tag requests with the product feature that triggered the call. Use Or using the shorthand header:
X-Metering-Tags for the full key-value form or X-Feature-Name as a shorthand when you only need a single feature label.By environment
By environment
Separate production spend from staging and development spend so you know exactly how much of your budget is attributable to live traffic.
By customer
By customer
For multi-tenant products, use You can also combine it with
X-Tenant-ID to attribute every call to the customer who triggered it. Avoid using mutable values like company names; prefer stable internal IDs.X-Metering-Tags to capture additional context alongside the tenant: