Platform
Tool fees
An agent that searches the web or calls a paid tool API spends money outside the model call. Record each of those calls with toolFee(), and the dashboard counts the dollars in your spend and lists them as tool fees, not as unknown models.
Before you start
- This is for search and tool APIs your own code pays for: Tavily, Exa, Serper, Brave Search, a scraping API. Web search that a model provider runs for you (Anthropic's web search tool) is billed on the model call itself.
- You need the TypeScript SDK (
@tokenmeter/sdk) 0.2.4 or later, or the Python SDK (tokenmeter-sdk) 0.2.5 or later. Without the SDK, send the same event over HTTP (see Without the SDK). - You send the dollar amount. Token Meter keeps no price list per vendor, so the cost is whatever your vendor charges you, usually its price per request times the number of requests.
Send a tool fee
Call it right after the tool call, with the vendor, how many requests the call made, and what they cost in US dollars. Inside an action() scope the fee is part of that action's trace and carries its customer, feature and team, like a model call.
import { TokenMeterClient, action, toolFee } from "@tokenmeter/sdk";
const tl = new TokenMeterClient({ apiKey: process.env.TOKEN_METER_KEY ?? "" });
await action("research", { customerRef: "cus_123", feature: "answers" }, async () => {
const results = await tavily.search("latest GPU prices");
// One search, at what your Tavily plan charges per search.
toolFee(tl, "tavily", 1, 0.008);
});
await tl.flush();Both return true when the fee was recorded. They never raise an error into your code: with an argument they can't use, they return false and send nothing.
What to send
- vendor: a short name, the same every time for one vendor. Letters, digits,
_,.and-, up to 55 characters. It is stored in lowercase, soTavilyandtavilyare the same vendor. A space or a:is refused. - count: how many requests this fee covers, a whole number of 0 or more. Send one fee per tool call, or one per batch with the batch's total count.
- cost (
costUsdin TypeScript,cost_usdin Python): the total for allcountrequests, in US dollars, 0 or more. Leave it out and the requests are still counted, but they show as unpriced and add nothing to spend. - Options:
latencyMs/latency_msfor how long the tool call took, andtagsfor extra tags on this fee (the total tags on one event stay under 2 KB, or nothing is sent).
One fee, one record
Each call totoolFee() is stored once, like a model call: a resent batch never counts a fee twice. Record a fee when the tool call is billed, not before you know it went through.Where it shows
- Analytics › Usage lists tool fees in their own Tool fees table below Models: vendor, cost, calls, cost per call and share of spend. The Tracked spend tile includes them and says how much (incl. $64.80 tool fees). The Requests and Avg latency tiles and the Models table leave them out, because a search is not a model request.
- Spend totals count the dollars like any other metered call: the Overview spend tile, budgets, customers, teams and features.
- Where a list names models (the Overview spend drill-down, Executive, Requests and a trace's page under Traffic › Traces), a fee reads Tavily (tool fee), never an unknown model id.
- Request counts outside Analytics › Usage, such as the Overview requests tile and the Requests list, count each
toolFee()call once.
Governance and Shadow AI
- A policy's model and provider lists don't apply to tool fees, so a model allowlist never holds one back. A policy's per-request cost cap and blocked data classes still do.
- Tool fees are not offered as models when you edit a policy's model list, and Shadow AI's Unapproved model finding skips them.
- The
tool_fee:model name is reserved for tool fees. An event that uses it with a provider other thanother, with token counts, with aunitsthat is not a whole number, or with anauthoritative_cost_usdthat is not a number, is held back asinvalid_tool_fee. A negative cost, or one over 1,000,000,000, is held back asnumber_out_of_range. Both are listed under Calls held for review, behind the Quality link at the foot of Data health › Readiness.
Without the SDK
toolFee() sends one ordinary usage event, so any sender can build it. Send it to POST https://ingest.timewastevc.com/v1/events:batch inside the usual envelope (see API reference › HTTP: send events):
{
"event_id": "018f6f2e-7b1a-7c3d-9a2b-1234567890ab",
"occurred_at": "2026-11-22T11:00:00Z",
"provider": "other",
"model_raw": "tool_fee:tavily",
"units": 1,
"authoritative_cost_usd": 0.008,
"tags": { "tool_fee": "tavily" },
"customer_ref": "cus_123",
"feature": "answers"
}Either marker is enough: an event with provider other, no tokens and tags.tool_fee set is stored under the model name tool_fee:<vendor>, and an event named tool_fee:<vendor> gets the tag.