credit-estimator is a
separate open-source project, published to npm under the @tansohq scope.
It forecasts credit or usage runway from observed history and explicit
low/base/high burn assumptions, and renders the result as an accessible React
widget.
It is provider-neutral: the deterministic core and React UI have no
Tanso dependency and work the same way for any host. An optional adapter maps
a Tanso snapshot into the same neutral input any other host would supply.
This is a read-only forecasting tool. It does not own wallets, ledgers,
usage events, entitlements, subscriptions, or payments — it projects a
balance from data you supply. It never writes back to Tanso.
Packages
All are ESM-only; CommonJS hosts need dynamic
import(). React peers are
^18.2 || ^19.
Calculate a forecast
asOf is explicit, and
invalid input throws a structured ForecastValidationError.
Plan credits before committing
The same core package answers the buyer-side question — “how many credits does this period need?” — with no usage history:estimatedUnits × creditsPerUnit, scenarios
scale that by their multipliers, and the optional allocation yields
utilization, surplus or shortfall, and a
WITHIN_ALLOCATION / OVER_ALLOCATION status per scenario. Everything is an
explicit input — the calculator never recommends weights or allocations,
never produces money amounts, and never predicts usage from history. Invalid
input throws a structured PlanValidationError.
For a Tanso host, no adapter is needed: creditsPerUnit is the resolved
weight your tariff returns as creditQuote.weight, and
allocation is the candidate credit grant.
The React package renders it with buyer-facing defaults (Conservative /
Expected / Aggressive scenario labels, an allocation meter, a per-metric
breakdown, and the calculation trace):
Embed the widget
input and result in as props. It has no fetch,
authentication, persistence, or billing dependency, so it never resolves a
stale forecast on its own. Theme it with the --credit-burndown-* CSS
variables, override any message string, inject your own action slot, and
control the selected scenario from outside.
Feeding it from Tanso
@tansohq/credit-forecast-tanso maps a Tanso snapshot plus explicit
assumptions into the same ForecastInput any other host would build by hand: