All insights

Inference economics

What Pricing History Should Be Retained to Recalculate a Historical Request?

To recalculate a historical request, retain the complete pricing configuration effective when the request occurred, the original metered facts, the context that selected the price, and every external calculation input. Each request must link to retrievable, unchanged versions of those records. “Always recalculable” is therefore a design objective that depends on preserving every relevant dependency—not a guarantee provided by a version ID or stored total alone.

To recalculate a historical request, retain the complete pricing configuration effective when the request occurred, the original metered facts, the context that selected the price, and every external calculation input. Each request must link to retrievable, unchanged versions of those records. “Always recalculable” is therefore a design objective that depends on preserving every relevant dependency—not a guarantee provided by a version ID or stored total alone.

Short Answer: Preserve the Complete Pricing State and Original Billable Facts

A reproducible charge requires more than an invoice, a final amount, or a label identifying the price version. The historical record should preserve four connected layers:

  1. Raw facts: What happened, when it happened, and what quantity was measured.
  2. Pricing state: The rates, tiers, commitments, discounts, and agreements in force for that event.
  3. Pricing decision: Why a particular price was selected for the account, product, region, route, or service tier.
  4. Calculation result: How the facts and rules produced the recorded monetary amount.

The pricing-version identifier connects these layers, but it is not a substitute for them. A version such as price-v42 has little long-term value if its rate card was overwritten, its customer assignment changed, or the rounding logic used by that version can no longer be retrieved.

Treat this information as a historical data contract. Every request should point to stable versions of its applicable pricing rules and retain enough original context to run the calculation again. The recalculated result can then be compared with the amount originally recorded, helping billing, finance, FinOps, and platform teams investigate differences without relying on current configuration.

Use Effective Dating to Resolve the Rules in Force at Event Time

Pricing records should use effective dates rather than being edited in place. At minimum, each version should have a stable identifier and a validity interval expressed through valid_from and valid_to timestamps. An open-ended valid_to can represent the current version, while previous intervals remain available for historical resolution.

Keep three different times separate:

  • Event time: When the billable activity actually occurred.
  • Ingestion time: When the usage event entered the metering or billing system.
  • Calculation time: When the event was priced, repriced, or corrected.

These timestamps answer different questions. A request may occur before a price change, arrive after that change, and be calculated later still. Applying the current rate merely because the event arrived late can produce a result inconsistent with the documented pricing policy.

The applicable time basis should be explicit. Many systems select a price using event time, but contracts or correction policies may define another rule. Retain both the timestamps and the policy version that determined which timestamp controlled price selection.

Effective-dating logic should also define interval boundaries precisely. For example, using inclusive lower bounds and exclusive upper bounds—valid_from <= event_time < valid_to—avoids ambiguity when one version ends at the exact instant another begins. Time zone and timestamp precision should remain consistent and retrievable as part of the calculation rules.

Version Every Rate, Adjustment, Agreement, and Pricing Assignment

Anything capable of changing a charge should be versioned rather than overwritten. Depending on the commercial model, that may include:

  • Rate cards and price books
  • Usage tiers and volume bands
  • Minimum charges and spending commitments
  • Contracted discounts and customer-specific rates
  • Credits, markups, and promotions
  • Included allowances or prepaid balances
  • Product, model, endpoint, region, or service-tier mappings
  • Rules governing which adjustments apply and in what order

Version the agreement separately from the underlying price book when necessary. Two customers can use the same base rate while having different contract terms, commitments, or discounts. A reproducible record therefore needs both the price version and the contract or agreement version applied to the request.

The assignment context is equally important. Retain the dimensions that caused the system to choose one pricing configuration rather than another, such as account, contract, product or model identifier, endpoint, region, service tier, and routing outcome where relevant. Historical account-to-contract and product-to-rate mappings must remain resolvable; current mappings cannot safely stand in for prior ones.

This approach also prevents a common problem: preserving an old rate card while losing the decision that selected it. Recalculation needs both the available rules and the historical path through those rules.

Keep Original Usage and Request Context Instead of Reconstructing It Later

Retain original billable quantities and their units before pricing transformations occur. A final amount cannot reveal whether it came from 10 units at one rate, 20 units at a discounted rate, or a minimum-charge rule. Similarly, a derived usage total may not reveal the raw measurements or aggregation logic behind it.

Separate the records into clear stages:

  • Original request or meter facts, as captured at the source
  • Derived quantities, such as normalized units or aggregated usage
  • Pricing decisions, including selected versions and applicable adjustments
  • Monetary results, including line items and the final charge

For AI inference, potentially relevant facts include the model and model-version identifiers, input and output usage, request time, cache treatment, batch context, and serving route. These fields should be retained when they affect metering, price selection, allocation, or reconciliation. They should not be assumed to affect price merely because they exist in serving telemetry.

This distinction matters in optimized inference environments. A request may pass through caching, routing, or batching logic, but telemetry describing those operations is not automatically sufficient for billing reproduction. The record still needs the original measured units, the applicable pricing rules, and the connection between the serving decision and the priced outcome.

Token Forge Cloud Managed Model APIs offer API-first model access and usage data for teams validating demand before moving toward private deployment. Organizations using that usage data for cost attribution should define which source fields are authoritative and preserve the historical pricing context separately rather than assuming that general usage telemetry alone can reproduce a charge.

Retain Calculation Rules, the Original Result, and an Explainable Trace

Once the correct usage and price versions have been identified, the calculation must still be executed using the same supporting rules. Preserve calculation dependencies such as:

  • Currency and the exchange-rate source and timestamp, where conversion applies
  • Tax or fee treatment where relevant to the agreement and jurisdiction
  • Rounding mode, decimal precision, and the stage at which rounding occurs
  • Unit conversions and aggregation rules
  • The order in which tiers, commitments, discounts, credits, and markups are applied

Calculation order can materially change the result. Applying a discount before a minimum charge may produce a different total than applying it afterward. Rounding individual line items can also differ from rounding only the final amount. These behaviors should be explicit, versioned, and linked to the request.

Store the original result alongside the reproducible inputs. Useful result records can include the pre-adjustment amount, adjustment line items, currency, final amount, and calculation timestamp. A calculation trace should explain which rules matched, which versions were loaded, what intermediate values were produced, and how the final total was derived.

The original total and trace support reconciliation, but neither replaces the underlying data. A trace can become unreadable if its referenced rules are deleted, while a stored total proves only what was recorded—not whether the calculation can be repeated.

A strong reconciliation process reruns the historical calculation and compares the reproduced amount with the original result. Any difference should be attributable to a documented correction, a changed implementation, or a missing dependency rather than being silently accepted.

Record Corrections Without Mutating the Historical Calculation

Corrections should preserve the original record. Instead of silently changing historical usage, rates, mappings, or totals, create an append-only revision, reversal, or superseding calculation according to the organization’s billing and accounting policies.

A correction record should link to:

  • The original request and calculation
  • The result being corrected or reversed
  • The reason for the change
  • The correction timestamp
  • The revised facts or rule versions
  • The replacement calculation and resulting adjustment

For example, if an incorrect product mapping selected the wrong rate, retain the original mapping decision and charge. Add a corrected mapping version, rerun the request under the applicable correction policy, and record the difference as a linked revision or adjustment. This preserves the ability to explain both what originally happened and why the billed outcome later changed.

Corrections also need their own time semantics. The underlying request still has its original event time, while the correction has a later decision and calculation time. Keeping those timestamps distinct prevents the revised record from appearing to be the initial outcome.

Use a Recalculation Record Checklist and Test Known Failure Modes

The following illustrative record structure connects the main elements required for historical reproduction. It is a design checklist, not a Token Forge Cloud API or database schema.

Record areaExample fieldsWhy retain it
Request identityRequest ID, account ID, source event IDConnects usage, pricing, results, and corrections
TimeEvent, ingestion, and calculation timestampsResolves effective rules and explains late processing
Measured usageOriginal quantities, units, measurement sourcePreserves billable facts before transformation
Workload contextProduct or model, endpoint, region, service tier, routeExplains price assignment when these dimensions matter
Pricing statePrice-book version, rate version, valid-from, valid-toIdentifies and retrieves the rules in force
Agreement stateContract version, commitment, discount, promotionReconstructs customer-specific commercial treatment
Calculation rulesCurrency, exchange rate, rounding, conversions, rule orderRepeats the original arithmetic and dependencies
Result and traceLine items, original charge, matched rules, intermediate valuesSupports comparison and explanation
Correction linkagePrior result ID, reason, correction time, replacement IDPreserves revisions without hiding the original outcome

Test the design against known failure modes before relying on it:

  • Can an old request still be priced after a rate card is replaced?
  • Can the system resolve a late-arriving event using the applicable historical policy?
  • Are historical account, contract, product, and model mappings still available?
  • Does recalculation use original usage rather than a newly derived approximation?
  • Are the historical exchange rate, precision, and rounding method retrievable?
  • Can deleted or renamed products and models still be resolved through stable identifiers?
  • Does a correction preserve both the original and replacement outcomes?

Retention duration is a policy decision rather than a universal number. It should account for contract terms, invoice and dispute windows, accounting requirements, operational investigation needs, and applicable legal obligations. The policy must cover all linked dependencies; keeping usage for longer than the corresponding prices, mappings, or exchange rates still breaks reproducibility.

For enterprise inference, apply this model only to dimensions that influence metering, allocation, price selection, or reconciliation. Token Forge Cloud Private LLM Inference supports serving-layer optimization through capabilities such as caching, routing, batching, quantization, and GPU scheduling. When an organization’s commercial model depends on any such serving decision, its billing architecture should preserve the relevant historical context. These serving capabilities do not by themselves replace the pricing-history and reconciliation design described above.

Contact Token Forge Cloud to discuss API access, private deployment, and LLM inference cost control.

Contact us