Costs and credits
What is billed
Learning is free. Only produced predictions are billed.
| Operation | Cost |
|---|---|
POST /v1/models, training | 0 credits |
POST /v1/models/{id}/predict | the engine's credits per scored row, 1 on the default engine |
POST /v1/forecast | horizon x number of series |
POST /v1/models/{id}/outcomes | 0 credits |
POST /v1/models/{id}/refresh | 0 credits |
| Every read | 0 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.
model.estimate_predict(rows) # 12 credits
spavik.estimate_forecast(series, horizon=7) # 7 creditsawait 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.
r = model.predict(rows)
r.cout # 12
r.solde # 88
spavik.usage()["predictions_remaining"] # the same number, any time, freeFrom 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.
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.