Represent model token usage and server-side tool execution as separate line items under the same request, trace, or workload cost record. Preserve each charge in its native billing unit, calculate distinct model and tool subtotals, and then show a combined total. This makes the record understandable without disguising tool fees as token consumption.
The short answer: separate the charges, then combine the totals
A model response can generate several cost drivers. The model may consume input and output tokens, while an agent or application may also invoke server-side search, document retrieval, code execution, image processing, or another provider-operated tool. These activities belong to the same workload, but they are not necessarily measured or priced in the same way.
The most useful representation therefore has two levels:
- Separate usage line items preserve what was consumed, how it was measured, and how the charge was calculated.
- A shared cost summary rolls those line items into model, tool, adjustment, and combined totals for the request or workload.
This structure gives engineering teams enough detail to investigate behavior while allowing finance, FinOps, and operations teams to allocate and reconcile costs. It also avoids implying that a tool billed per call, search, document, or unit of compute is simply another form of token usage.
Provider terminology and pricing mechanics vary. Some providers expose tool charges directly, some include selected operations in another price, and others provide only partial usage data. Implementations should use the fields that are actually available and verify charging rules against current provider documentation and finalized invoices.
A recommended cost equation
A practical calculation is:
model_usage_subtotal = sum(model usage line-item charges)
tool_execution_subtotal = sum(tool execution line-item charges)
combined_usage_subtotal = model_usage_subtotal + tool_execution_subtotal
final_cost = combined_usage_subtotal + separately identified provider adjustments
The adjustment component can represent applicable credits, corrections, minimum charges, or other provider-defined changes. It should remain separate rather than being allocated back into token or tool quantities without a defensible rule.
If multiple currencies appear, do not add them directly. Retain each original amount and currency first. A reporting layer can then produce a normalized view using an identified exchange-rate source and conversion timestamp.
Why tool fees should not be converted into artificial token counts
Converting a tool charge into an invented number of “equivalent tokens” may make a dashboard look simpler, but it removes the cost driver that buyers and operators need to understand.
For example, an increase in total cost might be caused by:
- longer prompts or model responses;
- more tool invocations per agent run;
- a change in the kind of tool being called;
- larger document or compute quantities;
- retries or repeated workflow steps; or
- a provider pricing change.
A blended token rate cannot reliably distinguish among these causes. It can also complicate provider comparisons because the artificial conversion depends on an arbitrary token price or allocation rule.
If a business needs one normalized metric for forecasting, it can calculate a secondary measure such as cost per completed workflow, cost per resolved request, or cost per processed document. That normalized KPI should sit above the source ledger; it should not replace native token and tool records.
Organize token usage and tool execution under one cost record
A useful cost record acts as an envelope around all billable activity associated with a request, trace, agent run, batch job, or other defined workload. Inside that envelope, each usage component remains independently identifiable.
The right aggregation level depends on the application:
- Request level works for straightforward model calls with zero or more tool invocations.
- Trace level is more useful for agents that perform several model calls and tool steps before completing a task.
- Workload or job level fits batch enrichment, document processing, and asynchronous pipelines.
- Organizational rollups group those underlying records by project, environment, tenant, business unit, or cost center.
Avoid storing only a daily model total and a daily tool total if request-level attribution is available. Although those totals may support accounting, they make it difficult to determine which workflow behavior produced the charge.
Token categories to retain when providers expose them
At minimum, model usage commonly distinguishes input from output tokens. Retain additional categories only when the provider reports them and their pricing treatment is known. Depending on the model or service, these could include cached input, cache creation, reasoning, image, audio, or other provider-defined units.
Each model-usage line should ideally preserve:
- usage category and provider-native name;
- model and provider identifiers;
- quantity and native unit;
- unit price or pricing reference when available;
- currency and extended charge;
- pricing version or effective date; and
- cost status, such as estimated or finalized.
Do not assume similarly named categories are economically equivalent across providers. One provider may expose cached usage separately, while another may incorporate it into a different rate or omit it from the usage response. A normalization layer should map categories for reporting while retaining the original provider value.
Request, trace, workload, and organizational metadata
Model and tool line items should share correlation metadata wherever the application and provider expose it. Useful fields include:
- request ID and trace ID;
- parent workflow, job, or agent-run ID;
- model and provider;
- project, application, and environment;
- tenant, team, or cost center;
- event and billing timestamps;
- region or endpoint identifier when relevant;
- source usage record or invoice reference;
- pricing version; and
- estimated, accrued, adjusted, or finalized status.
The distinction between event time and billing time matters. A request may occur in one reporting period but appear on a provider invoice later. Retaining both timestamps makes period-end accruals and subsequent reconciliation easier to explain.
The following example shows one way to structure a ledger. It is not a Token Forge Cloud product specification or a universal provider schema:
| Record | Parent trace | Charge class | Usage category | Native unit | Quantity | Unit price | Currency | Extended charge | Status |
|---|---|---|---|---|---|---|---|---|---|
| usage-001 | trace-784 | Model | Input | token | 12,000 | 0.000002 | USD | 0.024 | Estimated |
| usage-002 | trace-784 | Model | Output | token | 2,000 | 0.000006 | USD | 0.012 | Estimated |
| usage-003 | trace-784 | Tool | Search | search | 3 | 0.010 | USD | 0.030 | Estimated |
| usage-004 | trace-784 | Adjustment | Provider credit | credit | 1 | -0.005 | USD | -0.005 | Adjusted |
In this example, the model subtotal is USD 0.036, the tool subtotal is USD 0.030, and the adjustment is USD -0.005. The final illustrated total is USD 0.061. The values demonstrate the record structure only; they do not represent Token Forge Cloud pricing or any universal provider rate.
A corresponding JSON-style record might look like this:
{
"cost_record_id": "cost-784",
"request_id": "request-123",
"trace_id": "trace-784",
"provider": "example-provider",
"model": "example-model",
"project": "support-assistant",
"environment": "production",
"tenant": "tenant-42",
"event_timestamp": "2026-09-24T10:15:00Z",
"pricing_version": "example-version",
"cost_status": "estimated",
"line_items": [
{
"charge_class": "model",
"usage_category": "input",
"native_unit": "token",
"quantity": 12000,
"unit_price": 0.000002,
"currency": "USD",
"extended_charge": 0.024
},
{
"charge_class": "tool",
"tool_type": "search",
"invocation_id": "tool-call-9",
"native_unit": "search",
"quantity": 3,
"unit_price": 0.010,
"currency": "USD",
"extended_charge": 0.030
}
],
"subtotals": {
"model_usage": 0.036,
"tool_execution": 0.030,
"provider_adjustments": -0.005,
"final_cost": 0.061,
"currency": "USD"
},
"source_record": "example-usage-export"
}
Production schemas should not calculate totals from rounded display values. Retain the precision supplied by the provider, apply a documented rounding policy at the appropriate reporting level, and preserve the original source record for reconciliation.
Record each tool invocation in its provider-native billing unit
Each server-side tool invocation should be represented in the unit the provider uses to measure or bill it. Depending on the tool, that unit could be a call, search, document, page, processed byte, execution duration, compute unit, or another provider-defined measure. No single tool unit applies universally.
When available, retain the following details for every invocation:
- tool name and tool type;
- invocation ID and parent request or trace ID;
- invocation count;
- provider-native billing unit;
- measured quantity;
- unit price and currency;
- extended charge;
- execution status;
- retry or attempt number;
- pricing version or effective date; and
- provider usage-record reference.
Tool name and tool type serve different purposes. A provider-specific tool name supports invoice reconciliation, while a normalized type such as search, code_execution, or document_processing supports cross-workload analysis. Retaining both avoids losing source detail during normalization.
Handle retries, failures, and repeated agent steps explicitly
Application success and billable execution are not always the same event. A tool may complete but its result may be discarded, or an application may retry after a timeout. Providers may also differ in how unsuccessful or partial operations are charged.
Instead of silently removing those events, record each attempt and classify its outcome. Helpful statuses can include initiated, completed, failed, retried, cancelled, and billing status unknown. The final charge should follow the provider’s reported usage or invoice rather than an assumption that failed calls are free or fully billable.
For agentic workflows, use parent-child relationships to preserve sequence. One trace might contain several model calls, a search, two document fetches, and a repeated tool call. A trace-level total is useful, but the invocation-level records reveal whether cost growth came from model generation, tool frequency, or workflow looping.
Separate accrued costs from finalized invoice amounts
Real-time cost reporting often depends on an estimate derived from observed quantity and the pricing version believed to be in effect. The provider’s invoice may later reflect rounding, credits, repricing, minimums, delayed tool records, or other adjustments.
A robust lifecycle can use distinct states:
- Observed: usage occurred, but no price has been applied.
- Estimated: quantity has been multiplied by an applicable working rate.
- Accrued: the estimate has been assigned to a reporting period.
- Finalized: the amount has been reconciled to a provider billing record.
- Adjusted: a later credit, correction, or pricing change has been recorded.
Do not overwrite the original estimate when final amounts arrive. Store the finalized value and variance so teams can understand whether differences arose from missing usage, pricing logic, currency conversion, or provider adjustments.
Pricing versions are equally important. Recalculating historical usage with today’s price can rewrite prior economics. Retain the applicable price identifier or effective date and treat retroactive provider corrections as explicit adjustments.
Use cost visibility to inform serving-layer decisions
Separating model and tool costs does more than improve accounting. It helps teams identify which part of an AI workflow should be investigated and which controls can realistically influence it.
For example:
- Routing analysis can compare the model portion of cost across workload classes while keeping external tool charges visible.
- Caching decisions can examine repeated model context or eligible repeated work without assuming every tool result can or should be cached.
- Batching can be evaluated for suitable asynchronous model workloads, while per-invocation tool fees remain separately attributed.
- Quantization can be assessed as a private model-serving decision rather than being treated as a mechanism for changing third-party tool prices.
- GPU scheduling can inform infrastructure utilization for self-deployed inference but does not directly determine how an external provider bills a server-side tool.
This distinction is particularly important when comparing managed model API access with private deployment. API usage may begin with provider-reported token and tool records. As demand becomes more predictable, private deployment introduces infrastructure costs that may be measured through GPU time, capacity allocation, or internal chargeback rather than a public token rate. A consistent workload-level cost envelope can support both views without pretending that their underlying units are identical.
Token Forge Cloud Managed Model APIs provide an API-first path for model access and usage data. For organizations moving toward greater serving-layer control, Token Forge Cloud Private LLM Inference supports private deployment through capabilities including caching, routing, batching, quantization, and GPU scheduling.
Clear cost attribution can help teams decide where to examine serving policies and infrastructure economics. It should not be interpreted as a claim that serving-layer controls automatically reduce third-party tool fees: those charges remain subject to the tool provider’s pricing and billing rules.
Next step
Before implementing a normalized ledger, define the workload boundary, identify the usage fields each provider actually exposes, preserve native units, and establish a reconciliation process for estimates and invoices. This creates a durable foundation for comparing API consumption with private inference economics.
Contact Token Forge Cloud to discuss API access, private deployment, and LLM inference cost control.