Model Pinning

Given new training data, Nyckel automatically re-trains and re-deploys your function. This ensures that the /invoke endpoint always uses the most recent model. However, there are times when this behavior is undesirable. For example, you may want to do some integration testing or other checks before switching to a new function version.

In this guide we show you how to pin your invoke endpoint to a particular model version.

Locate your functions modelId

Projects that are enabled for model pinning have a "Model Info" panel on function-specific pages. This panel is located at the bottom of the right-hand column, below the label bars. Copy the value labeld "Model Id" for your modelId.

Invoke using a pinned model

To invoke using a pinned model, use the modelId query parameter. Like so:

curl -X POST \
  -H 'Authorization: Bearer <accessToken>' \
  -H 'Content-Type: application/json' \
  -d '{"data":"@<fileName>"}' \
import requests

url = '<functionId>/invoke?modelId=<modelId>'
headers = {
    'Authorization': 'Bearer ' + '<accessToken>',

result =, headers=headers, json={"data":"@<fileName>"})
fetch('<functionId>/invoke?modelId=<modelId>', {
    method: 'POST',
    headers: {
        'Authorization': 'Bearer ' + '<accessToken>',
        'Content-Type': 'application/json',
    body: JSON.stringify(
.then(response => response.json())
.then(data => console.log(data));
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, '<functionId>/invoke?modelId=<modelId>');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"data":"@<fileName>"}');

$headers = array();
$headers[] = 'Authorization: Bearer ' . '<accessToken>';
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;