Predict.aiDocs
Examples

A forecast with zero training

Deploy a pretrained foundation model zero-shot and get a probabilistic forecast in three calls.

Foundation models are pretrained — they've already learned general temporal patterns, so they can forecast your data without a training run. This example takes data you've already pushed, wraps it in a segment, and gets a quantile forecast from a foundation model. Total cost: zero training credits.

You'll need: a workspace with some daily history — the 30 days from Hello, predictAI work, though more history gives the model more to condition on.

1. Pick a model from the catalog

from predictai import PredictAI

client = PredictAI(token="pa_live_...", workspace_id="ws_...")

catalog = client.models.get_models_foundation()
for m in catalog["data"]["models"]:
    print(f'{m["family"]}/{m["slug"]:20} {m["params"]:>6} '
          f'horizon≤{m["supports"]["max_horizon"]}'
          + ("  ★ recommended" if m["recommended"] else ""))
chronos_bolt/chronos-bolt-base   205M horizon≤64  ★ recommended
predictfm/predictfm-f-v0.1        87M horizon≤128 ★ recommended

2. Frame the question as a segment

A zero-shot deployment has no training run to bind it to data, so you point it at a segment at inference time. The segment defines what to forecast — which series, on what grid:

segment = client.segments.post_segment(json={
    "name": "Signups, daily",
    "workspace_id": client.workspace_id,
    "features": ["site_visitors", "signups"],
    "labels": ["signups"],
    "interval": 86400,
    "live": True,
})
SEGMENT_ID = segment["data"]["uid"]

3. Deploy zero-shot

One call creates a live deployment — no model row, no pipeline, no training:

deployment = client.models.post_models_deploy_foundation(json={
    "family": "chronos_bolt",
    "slug": "chronos-bolt-base",
    "horizon": 14,
})
DEPLOYMENT_ID = deployment["data"]["promotion_id"]
print(deployment["data"]["status"])   # "deployed" - ready immediately

Zero-shot deployments run on always-on shared serving. If you deploy the same model twice you'll get a 409 whose details.promotion_id points at your existing deployment — reuse it.

4. Forecast, with uncertainty

Tell the deployment which segment to forecast. Foundation models are probabilistic — ask for quantiles and you get calibrated bands, not just a line:

forecast = client.inference.post_inference_deployments_by_deployment_id_infer_segment(
    DEPLOYMENT_ID,
    json={
        "segment_id": SEGMENT_ID,
        "horizon": 14,
        "quantile_levels": [0.1, 0.5, 0.9],
    },
)

pred = forecast["predictions"][0]
print("median:", [round(v, 1) for v in pred["quantiles"]["0.5"]])
print("p10   :", [round(v, 1) for v in pred["quantiles"]["0.1"]])
print("p90   :", [round(v, 1) for v in pred["quantiles"]["0.9"]])
median: [31.2, 31.8, 32.1, 31.5, ...]
p10   : [27.9, 28.1, 28.0, 27.4, ...]
p90   : [34.6, 35.4, 36.0, 35.7, ...]

If the model server was cold you'll get a 202 Accepted instead of a body — the forecast completes asynchronously. Poll as described in handling a 202; warm requests answer synchronously.

What you built

A live, probabilistic forecaster in three calls — and because the segment is live: true, every inference reads the newest data. Keep pushing signals and the forecast stays current without any retraining.

When zero-shot accuracy stops being enough, the same foundation model can be fine-tuned on your segment — add it to a pipeline and it trains a small adapter on your data. That's exactly what Race a model pool does.

On this page