Skip to content

Costs and credits

What is billed

Learning is free. Only produced predictions are billed.

OperationCost
POST /v1/models, training0 credits
POST /v1/models/{id}/predictthe engine's credits per scored row, 1 on the default engine
POST /v1/forecasthorizon x number of series
POST /v1/models/{id}/outcomes0 credits
POST /v1/models/{id}/refresh0 credits
Every read0 credits

To fix ideas: a forecast over 56 points with a horizon of 7 costs 7 credits, not 56. Several series in one call cost the same as separate calls and give the same values. Each engine states its price per prediction in GET /v1/engines; the default engine costs one credit.

See before you spend

The libraries compute the cost locally, without calling the API.

python
model.estimate_predict(rows)                    # 12 credits
spavik.estimate_forecast(series, horizon=7)     # 7 credits
js
await model.estimatePredict(rows);
await spavik.estimateForecast(series, { horizon: 7 });

And every billable response carries its cost and what remains: in the body when the route returns it, and always in the X-Spavik-Predictions-Remaining header, which the libraries read.

python
r = model.predict(rows)
r.cout    # 12
r.solde   # 88

spavik.usage()["predictions_remaining"]   # the same number, any time, free

From an agent, predict and forecast take dry_run: true on the MCP server: the exact same call sends nothing, charges nothing, and answers with the cost against what remains.

When the balance runs out

The API answers 402 CREDITS_EXHAUSTED, and the error carries the balance and the amount required.

python
from spavik import SpavikCreditsExhausted

try:
    model.predict(rows)
except SpavikCreditsExhausted as exc:
    print(exc.balance, exc.required, exc.request_id)

The credit balance takes over when the monthly included volume runs out: the API keeps answering instead of stopping mid-month.

Idempotency, so you never pay twice

The five mutating operations accept an Idempotency-Key header. Replaying the same call with the same key returns the already computed response, with no second charge.

The libraries set it themselves and replay it unchanged on their own retries. A network timeout is therefore never paid for twice.

Part of this documentation is generated from the OpenAPI contract.