Spavik
API referencePrediction

Make predictions

POST /v1/models/{id}/predict

Download OpenAPI
POST
/v1/models/{id}/predict

Authorization

apiKey
headerX-Spavik-Api-Key<token>

Spavik integration API key (sk-spv-api-...), sent in X-Spavik-Api-Key.

Path Parameters

id*string

Model identifier or slug

Header Parameters

Idempotency-Key?string

Same 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?string

Information 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.

Lengthlength <= 1024
X-Spavik-Client-Name?string

HTTP 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.

Lengthlength <= 128
X-Spavik-Client-Version?string

Version 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.

Lengthlength <= 64

Request Body

  1. body
rows*array<>

Data rows, one object per row.

engine_version?string

Full 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.

Match^(flair|presage|prophecy)-(latest|[1-9][0-9]*(\.[0-9]+)?)$
Lengthlength <= 64

Response Body

Success

application/json
  1. response
model_id?string
version?integer
engine?string

Exact engine used for this prediction.

n_scored?integer
took_ms?integer

Total 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