Tag your calls
Send a customer id, and optionally a feature name, with each call.- Proxy
- Node.js
- Python
Send headers on calls through the TensorCost proxy.
TENSORCOST_CUSTOMER and TENSORCOST_FEATURE environment variables. More on tags, teams and agents is in Attribution.
What the page shows
- A row per customer for this month or last month, with that customer’s spend and a per-feature breakdown.
- An Untagged row, always shown, with a line above the table saying what share of spend carries a customer tag.
- The top 500 customers. When there are more, the page says so, and the totals still count every customer.
- A month picker, in UTC calendar months. It sets the spend and the revenue together, so both cover the same days.
- On Scale and Enterprise, Revenue, Margin and Margin % columns. See Revenue and margins.
How the figure is counted
Each customer’s figure is their calls counted once. When a provider billed a day for less than the calls were metered, and the calls name their billing account, the customer counts at the bill, so discounts and credits are included. That starts two days after the day ends and doesn’t apply when an environment is selected. Otherwise the figure is the metered price. Sandbox calls count at metered cost. How TensorCost counts AI spend has the full rule. What providers billed beyond your calls lands in Untagged. Cloud bills and GPUs aren’t split by customer.Revenue and margins
Margins are on the Scale and Enterprise plans. On another plan the page says customer margins aren’t on your plan and shows spend only.
Revenue pushed from your system
Your billing job sends each customer’s running monthly total toPOST /v1/api/cost/revenue, signed with a signing secret an admin makes under Connect › API keys. The newest as_of wins, so a late or repeated job can’t roll a figure back, and negative values are allowed for credits and refunds. The full format, with a worked signing example, is on Push customer revenue.
Revenue from a CSV
For revenue you’d rather upload than push, an admin or finance user selects Import revenue (CSV) on the page. The columns are:monthisYYYY-MM.revenueis in major units with at most two decimals.currencyis a three-letter code such as USD or EUR.- A line with
0clears that customer’s month. In the example,globexhas no revenue for November. - The header names are not case-sensitive. A customer, month and currency can appear once in a file.
as_of.
A customer, month and currency holds one figure. A push and a CSV never add together. The figure with the later as_of stands, and a CSV’s as_of is the moment you uploaded it.
The same import is available to the API as POST /v1/api/cost/customer-revenue/import, with the file as the body and Content-Type: text/csv.
What margins feed
The monthly revenue also sets each customer’s limit in a margin floor budget, and the usage can be read back out:- A margin floor caps what a customer’s calls can cost against their revenue. A fixed amount caps it without revenue at all.
- Pull customer usage gives your billing job each customer’s daily cost and tokens.