Skip to main content
POST
https://serve.sutro.sh
/
functions
/
run
Running a Function
curl --request POST \
  --url https://serve.sutro.sh/functions/run \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "input_data": {}
}
'
{
  "response": "true",
  "confidence": 0.8847174048423767,
  "predictions": [
    {
      "label": "true",
      "confidence": 0.8847174048423767
    },
    {
      "label": "false",
      "confidence": 0.1152825877070427
    }
  ]
}
Using the API directly is not recommended for most users. Instead, we recommend using the Python SDK.
Execute privately served custom models that have been created via Sutro Functions.

Request Body

model
string
required
The name of the custom model to execute
input_data
object
required
Input data as required by the specific model. Refer to instructions from the Sutro team or your the Sutro web app for the specific input parameters required for your model.

Headers

Authorization
string
required
Your Sutro API key using Key authentication scheme.Format: Key YOUR_API_KEYExample: Authorization: Key sk_abc123...

Response

response
string|array|object
required
The value of the model’s most confidenct response. Depending on model type, may return a string, array, or object depending on function type. Refer to the Sutro web app for the expected return type of your model.
confidence
float
required
A calibrated confidence score for the returned value of the model.
predictions
array
required
An array containing objects that represent all possible model values, along with their confidence scores.
run_id
string
required
The ID of the function run.
{
  "response": "true",
  "confidence": 0.8847174048423767,
  "predictions": [
    {
      "label": "true",
      "confidence": 0.8847174048423767
    },
    {
      "label": "false",
      "confidence": 0.1152825877070427
    }
  ]
}

Code Examples

import requests

response = requests.post(
    'https://serve.sutro.sh/functions/run',
    headers={
        'Authorization': 'Key YOUR_SUTRO_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'model': 'is-hotdog',
        'input_data': {'brand': 'Oscar Meyer', 'description': 'Classic frankfurter, 8-pack'}
    }
)

result = response.json()
print(result)
This API is currently in development and subject to change.