The goal of vetiver is to provide fluent tooling to version, share, deploy, and monitor a trained model. Functions handle both recording and checking the model’s input data prototype, and predicting from a remote API endpoint. You can use vetiver with:

You can install the released version of vetiver from PyPI:

python -m pip install vetiver

And the development version from GitHub with:

python -m pip install git+

This website documents the public API of Vetiver (for Python). See for more on how to get started.


VetiverModel(model, model_name[, ...])

Create VetiverModel class for serving.

vetiver_pin_write(board, model[, versioned])

Pin a trained VetiverModel along with other model metadata.



Create a model card for documentation


VetiverAPI(model, check_prototype[, app_factory])

Create model aware API

run([port, host])

Start API

vetiver_post(endpoint_fx[, endpoint_name])

Create new POST endpoint that is aware of model input data


Wrap url where VetiverModel will be deployed

predict(endpoint, data, **kw)

Make a prediction from model endpoint

write_app(board, pin_name[, version, file, ...])

Write VetiverAPI app to a file

write_docker([app_file, path, rspm_env, ...])

Writes a Dockerfile to run VetiverAPI in a container

load_pkgs([model, packages, path])

Load packages necessary for predictions

prepare_docker(board, pin_name[, path, ...])

Create all files needed for Docker

deploy_rsconnect(connect_server, board, pin_name)

Deploy to Posit Connect


compute_metrics(data, date_var, period, ...)

Compute metrics for given time period

pin_metrics(board, df_metrics, metrics_pin_name)

Update an existing pin storing model metrics over time

plot_metrics(df_metrics[, date, estimate, ...])

Plot metrics over a given time period

Model Handlers#

BaseHandler(model, prototype_data)

Base handler class for creating VetiverModel of different type.

SKLearnHandler(model, prototype_data)

Handler class for creating VetiverModels with sklearn.

TorchHandler(model, prototype_data)

Handler class for creating VetiverModels with torch.

StatsmodelsHandler(model, prototype_data)

Handler class for creating VetiverModels with statsmodels.

XGBoostHandler(model, prototype_data)

Handler class for creating VetiverModels with xgboost.

Advanced Usage#

Advanced Usage