curl --request PUT \
--url https://console.vast.ai/api/v0/deployments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-model",
"tag": "v2",
"image": "pytorch/pytorch:2.0.0",
"search_params": "gpu_ram>=16 num_gpus=1",
"file_hash": "e3b0c44298fc1c149afb",
"file_size": 1048576,
"env": "-e MODEL=llama",
"storage": 100,
"ttl": 3600,
"version_label": "release-1.0",
"docker_login_user": "<string>",
"docker_login_pass": "<string>",
"docker_login_repo": "docker.io",
"cold_workers": 2,
"max_workers": 10,
"min_load": 0,
"min_cold_load": 0,
"target_util": 0.9,
"cold_mult": 3,
"max_queue_time": 60,
"target_queue_time": 10,
"inactivity_timeout": 300,
"overrecruit_ratio": 1.2,
"autoscaler_instance": "prod"
}
'import requests
url = "https://console.vast.ai/api/v0/deployments"
payload = {
"name": "my-model",
"tag": "v2",
"image": "pytorch/pytorch:2.0.0",
"search_params": "gpu_ram>=16 num_gpus=1",
"file_hash": "e3b0c44298fc1c149afb",
"file_size": 1048576,
"env": "-e MODEL=llama",
"storage": 100,
"ttl": 3600,
"version_label": "release-1.0",
"docker_login_user": "<string>",
"docker_login_pass": "<string>",
"docker_login_repo": "docker.io",
"cold_workers": 2,
"max_workers": 10,
"min_load": 0,
"min_cold_load": 0,
"target_util": 0.9,
"cold_mult": 3,
"max_queue_time": 60,
"target_queue_time": 10,
"inactivity_timeout": 300,
"overrecruit_ratio": 1.2,
"autoscaler_instance": "prod"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my-model',
tag: 'v2',
image: 'pytorch/pytorch:2.0.0',
search_params: 'gpu_ram>=16 num_gpus=1',
file_hash: 'e3b0c44298fc1c149afb',
file_size: 1048576,
env: '-e MODEL=llama',
storage: 100,
ttl: 3600,
version_label: 'release-1.0',
docker_login_user: '<string>',
docker_login_pass: '<string>',
docker_login_repo: 'docker.io',
cold_workers: 2,
max_workers: 10,
min_load: 0,
min_cold_load: 0,
target_util: 0.9,
cold_mult: 3,
max_queue_time: 60,
target_queue_time: 10,
inactivity_timeout: 300,
overrecruit_ratio: 1.2,
autoscaler_instance: 'prod'
})
};
fetch('https://console.vast.ai/api/v0/deployments', 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/deployments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'my-model',
'tag' => 'v2',
'image' => 'pytorch/pytorch:2.0.0',
'search_params' => 'gpu_ram>=16 num_gpus=1',
'file_hash' => 'e3b0c44298fc1c149afb',
'file_size' => 1048576,
'env' => '-e MODEL=llama',
'storage' => 100,
'ttl' => 3600,
'version_label' => 'release-1.0',
'docker_login_user' => '<string>',
'docker_login_pass' => '<string>',
'docker_login_repo' => 'docker.io',
'cold_workers' => 2,
'max_workers' => 10,
'min_load' => 0,
'min_cold_load' => 0,
'target_util' => 0.9,
'cold_mult' => 3,
'max_queue_time' => 60,
'target_queue_time' => 10,
'inactivity_timeout' => 300,
'overrecruit_ratio' => 1.2,
'autoscaler_instance' => 'prod'
]),
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/deployments"
payload := strings.NewReader("{\n \"name\": \"my-model\",\n \"tag\": \"v2\",\n \"image\": \"pytorch/pytorch:2.0.0\",\n \"search_params\": \"gpu_ram>=16 num_gpus=1\",\n \"file_hash\": \"e3b0c44298fc1c149afb\",\n \"file_size\": 1048576,\n \"env\": \"-e MODEL=llama\",\n \"storage\": 100,\n \"ttl\": 3600,\n \"version_label\": \"release-1.0\",\n \"docker_login_user\": \"<string>\",\n \"docker_login_pass\": \"<string>\",\n \"docker_login_repo\": \"docker.io\",\n \"cold_workers\": 2,\n \"max_workers\": 10,\n \"min_load\": 0,\n \"min_cold_load\": 0,\n \"target_util\": 0.9,\n \"cold_mult\": 3,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2,\n \"autoscaler_instance\": \"prod\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://console.vast.ai/api/v0/deployments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-model\",\n \"tag\": \"v2\",\n \"image\": \"pytorch/pytorch:2.0.0\",\n \"search_params\": \"gpu_ram>=16 num_gpus=1\",\n \"file_hash\": \"e3b0c44298fc1c149afb\",\n \"file_size\": 1048576,\n \"env\": \"-e MODEL=llama\",\n \"storage\": 100,\n \"ttl\": 3600,\n \"version_label\": \"release-1.0\",\n \"docker_login_user\": \"<string>\",\n \"docker_login_pass\": \"<string>\",\n \"docker_login_repo\": \"docker.io\",\n \"cold_workers\": 2,\n \"max_workers\": 10,\n \"min_load\": 0,\n \"min_cold_load\": 0,\n \"target_util\": 0.9,\n \"cold_mult\": 3,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2,\n \"autoscaler_instance\": \"prod\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/deployments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"my-model\",\n \"tag\": \"v2\",\n \"image\": \"pytorch/pytorch:2.0.0\",\n \"search_params\": \"gpu_ram>=16 num_gpus=1\",\n \"file_hash\": \"e3b0c44298fc1c149afb\",\n \"file_size\": 1048576,\n \"env\": \"-e MODEL=llama\",\n \"storage\": 100,\n \"ttl\": 3600,\n \"version_label\": \"release-1.0\",\n \"docker_login_user\": \"<string>\",\n \"docker_login_pass\": \"<string>\",\n \"docker_login_repo\": \"docker.io\",\n \"cold_workers\": 2,\n \"max_workers\": 10,\n \"min_load\": 0,\n \"min_cold_load\": 0,\n \"target_util\": 0.9,\n \"cold_mult\": 3,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2,\n \"autoscaler_instance\": \"prod\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"action": "created",
"deployment_id": 5,
"endpoint_id": 10,
"upload_url": "https://s3.amazonaws.com/bucket/...",
"upload_fields": {
"key": "1/myapp/abc123",
"AWSAccessKeyId": "..."
}
}{
"error": "<string>",
"msg": "<string>"
}{
"error": "<string>",
"msg": "<string>"
}Create or Update Deployment
Creates a new deployment or updates an existing one by name/tag, returning an S3 upload URL when a new file version needs to be uploaded.
curl --request PUT \
--url https://console.vast.ai/api/v0/deployments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-model",
"tag": "v2",
"image": "pytorch/pytorch:2.0.0",
"search_params": "gpu_ram>=16 num_gpus=1",
"file_hash": "e3b0c44298fc1c149afb",
"file_size": 1048576,
"env": "-e MODEL=llama",
"storage": 100,
"ttl": 3600,
"version_label": "release-1.0",
"docker_login_user": "<string>",
"docker_login_pass": "<string>",
"docker_login_repo": "docker.io",
"cold_workers": 2,
"max_workers": 10,
"min_load": 0,
"min_cold_load": 0,
"target_util": 0.9,
"cold_mult": 3,
"max_queue_time": 60,
"target_queue_time": 10,
"inactivity_timeout": 300,
"overrecruit_ratio": 1.2,
"autoscaler_instance": "prod"
}
'import requests
url = "https://console.vast.ai/api/v0/deployments"
payload = {
"name": "my-model",
"tag": "v2",
"image": "pytorch/pytorch:2.0.0",
"search_params": "gpu_ram>=16 num_gpus=1",
"file_hash": "e3b0c44298fc1c149afb",
"file_size": 1048576,
"env": "-e MODEL=llama",
"storage": 100,
"ttl": 3600,
"version_label": "release-1.0",
"docker_login_user": "<string>",
"docker_login_pass": "<string>",
"docker_login_repo": "docker.io",
"cold_workers": 2,
"max_workers": 10,
"min_load": 0,
"min_cold_load": 0,
"target_util": 0.9,
"cold_mult": 3,
"max_queue_time": 60,
"target_queue_time": 10,
"inactivity_timeout": 300,
"overrecruit_ratio": 1.2,
"autoscaler_instance": "prod"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my-model',
tag: 'v2',
image: 'pytorch/pytorch:2.0.0',
search_params: 'gpu_ram>=16 num_gpus=1',
file_hash: 'e3b0c44298fc1c149afb',
file_size: 1048576,
env: '-e MODEL=llama',
storage: 100,
ttl: 3600,
version_label: 'release-1.0',
docker_login_user: '<string>',
docker_login_pass: '<string>',
docker_login_repo: 'docker.io',
cold_workers: 2,
max_workers: 10,
min_load: 0,
min_cold_load: 0,
target_util: 0.9,
cold_mult: 3,
max_queue_time: 60,
target_queue_time: 10,
inactivity_timeout: 300,
overrecruit_ratio: 1.2,
autoscaler_instance: 'prod'
})
};
fetch('https://console.vast.ai/api/v0/deployments', 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/deployments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'my-model',
'tag' => 'v2',
'image' => 'pytorch/pytorch:2.0.0',
'search_params' => 'gpu_ram>=16 num_gpus=1',
'file_hash' => 'e3b0c44298fc1c149afb',
'file_size' => 1048576,
'env' => '-e MODEL=llama',
'storage' => 100,
'ttl' => 3600,
'version_label' => 'release-1.0',
'docker_login_user' => '<string>',
'docker_login_pass' => '<string>',
'docker_login_repo' => 'docker.io',
'cold_workers' => 2,
'max_workers' => 10,
'min_load' => 0,
'min_cold_load' => 0,
'target_util' => 0.9,
'cold_mult' => 3,
'max_queue_time' => 60,
'target_queue_time' => 10,
'inactivity_timeout' => 300,
'overrecruit_ratio' => 1.2,
'autoscaler_instance' => 'prod'
]),
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/deployments"
payload := strings.NewReader("{\n \"name\": \"my-model\",\n \"tag\": \"v2\",\n \"image\": \"pytorch/pytorch:2.0.0\",\n \"search_params\": \"gpu_ram>=16 num_gpus=1\",\n \"file_hash\": \"e3b0c44298fc1c149afb\",\n \"file_size\": 1048576,\n \"env\": \"-e MODEL=llama\",\n \"storage\": 100,\n \"ttl\": 3600,\n \"version_label\": \"release-1.0\",\n \"docker_login_user\": \"<string>\",\n \"docker_login_pass\": \"<string>\",\n \"docker_login_repo\": \"docker.io\",\n \"cold_workers\": 2,\n \"max_workers\": 10,\n \"min_load\": 0,\n \"min_cold_load\": 0,\n \"target_util\": 0.9,\n \"cold_mult\": 3,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2,\n \"autoscaler_instance\": \"prod\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://console.vast.ai/api/v0/deployments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-model\",\n \"tag\": \"v2\",\n \"image\": \"pytorch/pytorch:2.0.0\",\n \"search_params\": \"gpu_ram>=16 num_gpus=1\",\n \"file_hash\": \"e3b0c44298fc1c149afb\",\n \"file_size\": 1048576,\n \"env\": \"-e MODEL=llama\",\n \"storage\": 100,\n \"ttl\": 3600,\n \"version_label\": \"release-1.0\",\n \"docker_login_user\": \"<string>\",\n \"docker_login_pass\": \"<string>\",\n \"docker_login_repo\": \"docker.io\",\n \"cold_workers\": 2,\n \"max_workers\": 10,\n \"min_load\": 0,\n \"min_cold_load\": 0,\n \"target_util\": 0.9,\n \"cold_mult\": 3,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2,\n \"autoscaler_instance\": \"prod\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.vast.ai/api/v0/deployments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"my-model\",\n \"tag\": \"v2\",\n \"image\": \"pytorch/pytorch:2.0.0\",\n \"search_params\": \"gpu_ram>=16 num_gpus=1\",\n \"file_hash\": \"e3b0c44298fc1c149afb\",\n \"file_size\": 1048576,\n \"env\": \"-e MODEL=llama\",\n \"storage\": 100,\n \"ttl\": 3600,\n \"version_label\": \"release-1.0\",\n \"docker_login_user\": \"<string>\",\n \"docker_login_pass\": \"<string>\",\n \"docker_login_repo\": \"docker.io\",\n \"cold_workers\": 2,\n \"max_workers\": 10,\n \"min_load\": 0,\n \"min_cold_load\": 0,\n \"target_util\": 0.9,\n \"cold_mult\": 3,\n \"max_queue_time\": 60,\n \"target_queue_time\": 10,\n \"inactivity_timeout\": 300,\n \"overrecruit_ratio\": 1.2,\n \"autoscaler_instance\": \"prod\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"action": "created",
"deployment_id": 5,
"endpoint_id": 10,
"upload_url": "https://s3.amazonaws.com/bucket/...",
"upload_fields": {
"key": "1/myapp/abc123",
"AWSAccessKeyId": "..."
}
}{
"error": "<string>",
"msg": "<string>"
}{
"error": "<string>",
"msg": "<string>"
}Authorizations
API key must be provided in the Authorization header
Body
Deployment name (letters, numbers, hyphens, dots, underscores; must start with letter or number; max 128 chars).
"my-model"
Deployment tag used to differentiate variants of the same named deployment; defaults to 'default'.
"v2"
Docker image to run on worker instances; required.
"pytorch/pytorch:2.0.0"
GPU offer filter expression for selecting worker machines.
"gpu_ram>=16 num_gpus=1"
SHA-256 (or similar) hash of the deployment artifact to upload; required and used as a cache key.
"e3b0c44298fc1c149afb"
Size in bytes of the deployment artifact; required when file_hash is provided.
1048576
Environment variable string to inject into workers (e.g. '-e FOO=bar').
"-e MODEL=llama"
Disk storage to allocate per worker in GB; must be positive; defaults to 50.
100
Seconds after the last heartbeat before the deployment is automatically deleted; negative disables auto-expiry.
3600
Human-readable label for this artifact version; defaults to first 6 chars of file_hash.
"release-1.0"
Docker registry username for pulling private images.
Docker registry password for pulling private images.
Docker registry hostname/repo to authenticate against.
"docker.io"
Fixed number of cold standby workers for the backing endpoint.
2
Maximum number of workers for the backing endpoint.
10
Minimum load threshold for the backing endpoint.
0
Minimum cold load threshold for the backing endpoint.
0
Target utilization ratio (0-1) for the backing endpoint.
0.9
Cold-standby multiplier for the backing endpoint.
3
Maximum acceptable queue time in seconds.
60
Target queue time in seconds.
10
Seconds of inactivity before the endpoint may be suspended.
300
Ratio by which to over-recruit workers for traffic spike absorption.
1.2
Autoscaler deployment environment.
"prod"
Response
Returns {success: true, action: 'created'|'soft_update'|'autoscale_update'|'exists', deployment_id, endpoint_id, upload_url?, upload_fields?, evicted_versions?}
Always true on success.
One of: created, soft_update, autoscale_update, exists.
ID of the deployment.
ID of the associated endpoint.
Presigned S3 URL to upload the deployment blob (present when a new version needs to be uploaded).
Additional fields required for the S3 multipart POST upload (present with upload_url).
List of evicted version objects ({id, file_hash, version_label, file_size}) if LRU eviction occurred.