Make predictions
POST /v1/models/{id}/predict
apiKeyX-Spavik-Api-Key<token>Spavik integration API key (sk-spv-api-...), sent in X-Spavik-Api-Key.
id*stringModel identifier or slug
Idempotency-Key?stringSame workspace, method, path, key and payload prevent another execution or charge, subject to current model access. Successful responses are replayed for every data policy, including ZDR, from the technical PostgreSQL cache (default retention 24 hours from operation creation). The data policy only controls inference input/output archiving to GCS/BigQuery; it never changes replay behavior. A different key or an expired completed key starts a new operation and may be charged again. REQUEST_IN_PROGRESS: wait Retry-After. REQUEST_INTERRUPTED: outcome uncertain; contact support. IDEMPOTENCY_RESPONSE_UNAVAILABLE: a completed response is missing; do not retry with a new key. Completed keys expire; unresolved keys remain protected. Reusing a key with different input returns 422. A key is required on the original call for safe retries.
User-Agent?stringInformation about the agent originating the request, when known. Browsers supply their own value. Optional diagnostic metadata, declared by the caller and never used for authorization. Omit unknown values. Values are trimmed and truncated to the documented length.
length <= 1024X-Spavik-Client-Name?stringHTTP caller: SDK, MCP server or direct application (for example spavik-sdk-python, spavik-sdk-javascript or spavik-mcp). Optional diagnostic metadata, declared by the caller and never used for authorization. Omit unknown values. Values are trimmed and truncated to the documented length.
length <= 128X-Spavik-Client-Version?stringVersion of that SDK, MCP server or direct application. Optional diagnostic metadata, declared by the caller and never used for authorization. Omit unknown values. Values are trimmed and truncated to the documented length.
length <= 64- body
rows*array<>Data rows, one object per row.
engine_version?stringFull engine identifier within the selected family, e.g. presage-2 or presage-latest. Omitted or -latest: latest active version of that family. A different family is refused. Responses identify the exact version used.
^(flair|presage|prophecy)-(latest|[1-9][0-9]*(\.[0-9]+)?)$length <= 64Success
application/json- response
model_id?stringversion?integerengine?stringExact engine used for this prediction.
n_scored?integertook_ms?integerTotal time on the Spavik side.
predictions?array<>One entry per row sent, in the same order. prediction is a number for regression, and for classification the predicted class (a number when the classes are numeric, text otherwise). Classification also returns one probability per class (proba_<class>).
import requestsurl = "https://api.spavik.co/v1/models/string/predict"body = """{ "rows": [ { "plan": "free", "seats": 2, "tickets_90d": 7 } ]}"""response = requests.request("POST", url, data = body, headers = { "Content-Type": "application/json"})print(response.text){ "model_id": "string", "version": 0, "engine": "string", "n_scored": 0, "took_ms": 0, "predictions": [ { "request_id": "string", "prediction": 0, "property1": 0, "property2": 0 } ]}How is this guide?
Last updated on