Skip to main content
POST
/
v1
/
predict
import os, json, requests

# Define your test dataset path
test_path = "test.csv"

# Get your API key from the environment
api_key = os.getenv("PRIORLABS_API_KEY")
headers = {"Authorization": f"Bearer {api_key}"}

# Create prediction payload
payload = {
 "task": "classification",
 "model_id": model_id, # Use model_id from your /v1/fit call
}

files = {
    "data": (None, json.dumps(payload), "application/json"),
    "file": (test_path, open(test_path, "rb")),
}

predict_response = requests.post(
    "https://api.priorlabs.ai/v1/predict",
    headers=headers,
    files=files,
)

print("✅ Predictions:")
print(json.dumps(predict_response.json(), indent=2))
{
  "duration_seconds": 15,
  "prediction": [
    [
      0.1,
      0.9
    ],
    [
      0.8,
      0.2
    ]
  ],
  "task": "classification",
  "params": {
    "average_before_softmax": false,
    "categorical_features_indices": null,
    "device": [
      "cpu"
    ],
    "differentiable_input": false,
    "fit_mode": "fit_preprocessors",
    "ignore_pretraining_limits": true,
    "inference_config": null,
    "inference_precision": "auto",
    "memory_saving_mode": true,
    "model_path": "auto",
    "n_estimators": 8,
    "n_jobs": null,
    "n_preprocessing_jobs": 4,
    "random_state": 42,
    "softmax_temperature": 0.2
  },
  "used_credits": 10,
  "remaining_quota": 90
}

Documentation Index

Fetch the complete documentation index at: https://docs.priorlabs.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer token for authentication, obtained after signing up and generating an API key.

Body

multipart/form-data
data
string
required

A JSON string defining the prediction request parameters.

Required fields:

  • model_id (str) - Model ID from your previous /v1/fit call
  • task (str) - Task type: "classification" or "regression"

Optional Config Parameters:

  • systems (list[str]) - default: ["preprocessing", "text"]. The following preprocessing systems are supported:
    • ["preprocessing"] - Applies skrub preprocessing,
    • ["text"] - Adds text embeddings for text columns.
  • n_estimators (int) - Number of estimators in the ensemble (1-10)
  • model_path (str) - Model checkpoint path from HuggingFace
  • categorical_features_indices (List[int]) - Indices of categorical features
  • softmax_temperature (float) - Temperature for softmax scaling
  • average_before_softmax (bool) - Average before applying softmax
  • ignore_pretraining_limits (bool) - Ignore pretraining limits
  • inference_precision (str) - Inference precision ("float32", "float16", "auto")
  • random_state (int) - Random seed for reproducibility
  • balance_probabilities (bool) - Balance class probabilities

Optional Params (output configuration):

  • output_type (str) - Determines prediction output format
    • Classification: "probas" (default, probabilities) or "preds" (predictions)
    • Regression: "mean" (default, mean value) or "full" (includes quantiles, ei, pi)
file
file
required

CSV file containing the dataset to predict on.

Response

Prediction completed successfully — returns predicted values or probabilities depending on the task.

duration_seconds
integer
required

Time taken (in seconds) to complete the prediction.

prediction
required

The prediction output. Format depends on task and output_type:

  • Regression: List of floats (e.g., [1250.5, 3200.8, 980.2])
  • Classification with output_type: probas: List of lists (probabilities) (e.g., [[0.1, 0.9], [0.8, 0.2]])
  • Classification with output_type: preds: List of classes (e.g., ["class_0", "class_1"])
task
enum<string>
required

Specifies the type of task to perform — either classification or regression.

Available options:
classification,
regression
used_credits
integer
required

The number of credits consumed by this API call.

remaining_quota
integer
required

Your remaining credit balance after this request.

params
object

The inference parameters that were used during prediction.