curl --request POST \
--url https://console.vast.ai/api/v0/endptjobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"min_load": 50,
"min_cold_load": 0,
"target_util": 0.75,
"cold_mult": 2,
"cold_workers": 5,
"max_workers": 20,
"max_queue_time": 60,
"target_queue_time": 10,
"autoscaler_instance": "prod",
"endpoint_state": "active",
"endpoint_name": "my_endpoint",
"inactivity_timeout": 300,
"overrecruit_ratio": 1.2
}
'import requests
url = "https://console.vast.ai/api/v0/endptjobs"
payload = {
"min_load": 50,
"min_cold_load": 0,
"target_util": 0.75,
"cold_mult": 2,
"cold_workers": 5,
"max_workers": 20,
"max_queue_time": 60,
"target_queue_time": 10,
"autoscaler_instance": "prod",
"endpoint_state": "active",
"endpoint_name": "my_endpoint",
"inactivity_timeout": 300,
"overrecruit_ratio": 1.2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
min_load: 50,
min_cold_load: 0,
target_util: 0.75,
cold_mult: 2,
cold_workers: 5,
max_workers: 20,
max_queue_time: 60,
target_queue_time: 10,
autoscaler_instance: 'prod',
endpoint_state: 'active',
endpoint_name: 'my_endpoint',
inactivity_timeout: 300,
overrecruit_ratio: 1.2
})
};
fetch('https://console.vast.ai/api/v0/endptjobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://console.vast.ai/api/v0/endptjobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'min_load' => 50,
'min_cold_load' => 0,
'target_util' => 0.75,
'cold_mult' => 2,
'cold_workers' => 5,
'max_workers' => 20,
'max_queue_time' => 60,
'target_queue_time' => 10,
'autoscaler_instance' => 'prod',
'endpoint_state' => 'active',
'endpoint_name' => 'my_endpoint',
'inactivity_timeout' => 300,
'overrecruit_ratio' => 1.2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://console.vast.ai/api/v0/endptjobs"
payload := strings.NewReader("{\n \"min_load\": 50,\n \"min_cold_load\": 0,\n \"target_util\": 0.75,\n \"cold_mult\": 2,\n \"cold_workers\": 5,\n \"max_workers\": 20,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"autoscaler_instance\": \"prod\",\n \"endpoint_state\": \"active\",\n \"endpoint_name\": \"my_endpoint\",\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://console.vast.ai/api/v0/endptjobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"min_load\": 50,\n \"min_cold_load\": 0,\n \"target_util\": 0.75,\n \"cold_mult\": 2,\n \"cold_workers\": 5,\n \"max_workers\": 20,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"autoscaler_instance\": \"prod\",\n \"endpoint_state\": \"active\",\n \"endpoint_name\": \"my_endpoint\",\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/endptjobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"min_load\": 50,\n \"min_cold_load\": 0,\n \"target_util\": 0.75,\n \"cold_mult\": 2,\n \"cold_workers\": 5,\n \"max_workers\": 20,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"autoscaler_instance\": \"prod\",\n \"endpoint_state\": \"active\",\n \"endpoint_name\": \"my_endpoint\",\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"result": 15
}{
"error": "<string>",
"msg": "<string>"
}{
"error": "<string>",
"msg": "<string>"
}Create Endpoint
Creates a new serverless endpoint (endptjob) for the authenticated user with the specified autoscaling configuration.
curl --request POST \
--url https://console.vast.ai/api/v0/endptjobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"min_load": 50,
"min_cold_load": 0,
"target_util": 0.75,
"cold_mult": 2,
"cold_workers": 5,
"max_workers": 20,
"max_queue_time": 60,
"target_queue_time": 10,
"autoscaler_instance": "prod",
"endpoint_state": "active",
"endpoint_name": "my_endpoint",
"inactivity_timeout": 300,
"overrecruit_ratio": 1.2
}
'import requests
url = "https://console.vast.ai/api/v0/endptjobs"
payload = {
"min_load": 50,
"min_cold_load": 0,
"target_util": 0.75,
"cold_mult": 2,
"cold_workers": 5,
"max_workers": 20,
"max_queue_time": 60,
"target_queue_time": 10,
"autoscaler_instance": "prod",
"endpoint_state": "active",
"endpoint_name": "my_endpoint",
"inactivity_timeout": 300,
"overrecruit_ratio": 1.2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
min_load: 50,
min_cold_load: 0,
target_util: 0.75,
cold_mult: 2,
cold_workers: 5,
max_workers: 20,
max_queue_time: 60,
target_queue_time: 10,
autoscaler_instance: 'prod',
endpoint_state: 'active',
endpoint_name: 'my_endpoint',
inactivity_timeout: 300,
overrecruit_ratio: 1.2
})
};
fetch('https://console.vast.ai/api/v0/endptjobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://console.vast.ai/api/v0/endptjobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'min_load' => 50,
'min_cold_load' => 0,
'target_util' => 0.75,
'cold_mult' => 2,
'cold_workers' => 5,
'max_workers' => 20,
'max_queue_time' => 60,
'target_queue_time' => 10,
'autoscaler_instance' => 'prod',
'endpoint_state' => 'active',
'endpoint_name' => 'my_endpoint',
'inactivity_timeout' => 300,
'overrecruit_ratio' => 1.2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://console.vast.ai/api/v0/endptjobs"
payload := strings.NewReader("{\n \"min_load\": 50,\n \"min_cold_load\": 0,\n \"target_util\": 0.75,\n \"cold_mult\": 2,\n \"cold_workers\": 5,\n \"max_workers\": 20,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"autoscaler_instance\": \"prod\",\n \"endpoint_state\": \"active\",\n \"endpoint_name\": \"my_endpoint\",\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://console.vast.ai/api/v0/endptjobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"min_load\": 50,\n \"min_cold_load\": 0,\n \"target_util\": 0.75,\n \"cold_mult\": 2,\n \"cold_workers\": 5,\n \"max_workers\": 20,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"autoscaler_instance\": \"prod\",\n \"endpoint_state\": \"active\",\n \"endpoint_name\": \"my_endpoint\",\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/endptjobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"min_load\": 50,\n \"min_cold_load\": 0,\n \"target_util\": 0.75,\n \"cold_mult\": 2,\n \"cold_workers\": 5,\n \"max_workers\": 20,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"autoscaler_instance\": \"prod\",\n \"endpoint_state\": \"active\",\n \"endpoint_name\": \"my_endpoint\",\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"result": 15
}{
"error": "<string>",
"msg": "<string>"
}{
"error": "<string>",
"msg": "<string>"
}Authorizations
API key must be provided in the Authorization header
Body
Minimum load for the endpoint.
50
Minimum cold load threshold below which cold workers are maintained.
0
Target utilization for the endpoint.
0.75
Multiplier for cold start.
2
Number of cold workers.
5
Maximum number of workers.
20
Maximum acceptable queue time in seconds before scaling up.
60
Desired queue time in seconds that the autoscaler targets; must be <= max_queue_time.
10
Autoscaler deployment environment to attach this endpoint to.
"prod"
Initial activation state of the endpoint.
active, suspended, stopped "active"
Name of the endpoint.
"my_endpoint"
Seconds of inactivity after which the autoscaler may suspend the endpoint.
300
Ratio by which to over-recruit workers to absorb traffic spikes.
1.2