Skip to content
Tenzro
← All tutorials
Tutorial · Inference and training

Forecast with TimesFM

Run timeseries forecasting with TimesFM 2.5 on Tenzro Network 1: point forecasts and quantile intervals over the CLI, HTTP and JSON-RPC.

Beginner10 min

TimesFM 2.5 is a timeseries foundation model. You give it a history of observations and a horizon, and it returns a point forecast and, if you ask, quantile bands. Tenzro serves it through the forecast runtime, so the same model answers over the CLI, a Tenzro HTTP route and JSON-RPC, and every call is metered per use.

Prerequisites

  • The tenzro CLI installed. See Getting started.
  • To call the public endpoint: an API key (header X-Tenzro-Api-Key) or a wallet that pays per request over HTTP 402.
  • To load the model yourself: a node you operate with the ai role. See Model serving.

1. Load the model on your node

TimesFM is in the permissive licence tier, so no licence flag is needed. The ONNX graph must already be on the node's disk; --catalog-id supplies the context window, maximum horizon and output tensor name. Loading is an operator action, so run it against your own node.

bash
tenzro forecast catalog

tenzro forecast load \
  --model fc \
  --path /models/timesfm-2.5-200m.onnx \
  --catalog-id timesfm-2.5-200m

2. Prepare the history

The history is a flat array of numbers, one observation per step, oldest first. For example, hourly GPU utilisation from one of your machines:

bash
cat > history.json <<'JSON'
[61.2, 62.5, 63.1, 64.0, 63.7, 65.2, 66.0, 67.1, 66.4, 68.0, 69.3, 70.1]
JSON

You can also pass it inline with --context 61.2,62.5,63.1.

3. Run a forecast

A point forecast comes back by default. Add --quantile for prediction intervals, and --frequency-seconds to tell models that read it how far apart the steps are.

bash
tenzro forecast run --model fc --context-file history.json --horizon 24

tenzro forecast run \
  --model fc \
  --context-file history.json \
  --horizon 24 \
  --quantile 0.1,0.5,0.9 \
  --frequency-seconds 3600

Expected output (abridged):

json
{
  "point": [70.6, 71.0, 71.2, "..."],
  "quantiles": [[68.9, "..."], [70.6, "..."], [72.4, "..."]],
  "quantile_levels": [0.1, 0.5, 0.9],
  "generation_time_ms": 12,
  "cost_wei": "…"
}

quantiles holds one series per requested level, in the order of quantile_levels.

4. Call a provider over HTTP

Forecasting has no OpenAI equivalent, so it is served at POST /v1/tenzro/forecasts.

bash
curl -s https://rpc.tenzro.xyz/v1/tenzro/forecasts \
  -H 'content-type: application/json' \
  -H "X-Tenzro-Api-Key: $TENZRO_API_KEY" \
  -d '{"model":"fc","history":[61.2,62.5,63.1,64.0,63.7,65.2],"horizon":12,"quantiles":[0.1,0.5,0.9],"frequency_seconds":3600}'

The response has object: "forecast", the point and quantiles arrays, and the metered units and cost_wei. An empty history or a zero horizon is rejected with a 400.

5. Call it over JSON-RPC

tenzro_forecast takes the series as history and the model as model_id. quantiles and frequency_seconds are optional.

bash
curl -s https://rpc.tenzro.xyz \
  -H 'content-type: application/json' \
  -H "X-Tenzro-Api-Key: $TENZRO_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tenzro_forecast","params":{"model_id":"fc","history":[61.2,62.5,63.1],"horizon":12,"quantiles":[0.1,0.5,0.9]}}'

Forecasts are billed on the number of history steps read and forecast values emitted, with each quantile band counting as its own series.

Next steps