Is Token Forecast production-ready at 1.0.0?
Yes. 53 tests across 12 suites pass under Vitest 4 with 95% line coverage; TypeScript 6 maximum strict
mode is clean; Biome 2 lint is clean; publint is clean. Every published release carries SLSA
provenance produced by GitHub Actions, and the dist artefact is exercised end-to-end by a smoke script,
including the CLI exit codes and the cold-start path.
Is this machine learning?
No, and that is deliberate. The engine is classical statistics: exponential smoothing (Holt-Winters,
Holt, SES) with learned seasonality, robust anomaly scoring, and a Page-Hinkley drift test. It is
explainable, and every forecast ships the backtested error (MAPE and sMAPE) that earned it, so you can
audit the choice instead of trusting a black box.
How is this different from CloudZero, Helicone, or Langfuse?
Those are hosted dashboards or observability platforms. Token Forecast is an embeddable, zero-dependency
library and CLI that runs in your process, so an agent or service can read its own forecast and act on it,
not just a human reading a chart. They are complementary: stream the same events to both.
Does this work in Cloudflare Workers, Vercel Edge, Bun, or Deno?
Yes. The whole engine is Node-free, so the @takk/tokenforecast/edge entry exposes the full
core under a worker condition. It runs on any modern JavaScript runtime, no built-in
fetch or filesystem required, because Token Forecast makes no network or disk calls.
Does Token Forecast hardcode provider prices?
No. You supply the cost on each event, so a forecast never goes stale against a bundled
price table. The scenario engine re-costs what-if model swaps over a price book you pass at call time, and
price-shift detection derives effective prices from your own recorded data.
How much history do I need before forecasts are useful?
Holt-Winters wants roughly two full seasons (about 14 daily buckets for weekly seasonality). With less,
the backtest selects a simpler method and the interval widens honestly. For a brand-new feature with
almost no data, pass a cold-start prior and get a wide-interval forecast from day one.
What does the prediction interval mean?
Each forecast point carries a lower and upper bound at your confidence
level (default 0.9, a 90% band), derived from an inverse-normal quantile of the residual
scale and clamped so the lower bound never falls below zero. A wider band means the model is less certain,
not that it failed.
Can I trust the forecast number?
Trust the number as far as its backtest says. Every Forecast includes a
backtest with MAPE, sMAPE, MAE, and the number of held-out samples from a rolling-origin
evaluation. Read the error alongside the mean; a tight interval with low sMAPE is a confident forecast, a
wide one is a flag to gather more data.
Can I forecast tokens or call count instead of cost?
Yes. Every bucket carries cost, tokens, and count, and the forecaster takes a metric option
of 'cost', 'tokens', or 'count'. Forecast whichever signal you
budget against.
How does cold-start avoid making numbers up?
It never invents a prior. You supply the expected per-bucket cost and your uncertainty; Token Forecast
blends that with whatever thin history exists through a conjugate normal-mean update and widens the
interval. If your prior is wrong, the forecast is wrong, which is why the method is labelled
cold-start in the result.
How do I verify a published version's provenance?
Every release is published with npm publish --provenance. Check the attestations with
npm view @takk/tokenforecast@<version> --json | jq .dist.attestations. The attestation
links the tarball you installed to the GitHub Actions workflow that built it from a specific source commit.
What is the policy on breaking changes?
Strict SemVer 2.0.0, starting from 1.0.0. The binding stability surface is documented in SPEC.md section
5. Which method the engine auto-selects is not part of that surface; pin it with options.method
if you need byte-stable output. Major bumps require a deprecation cycle; security fixes follow the
disclosure flow in SECURITY.md.