Skip to main content
POST
/
api
/
v0
/
workergroups
create workergroup
curl --request POST \
  --url https://console.vast.ai/api/v0/workergroups \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "endpoint_name": "vLLM-Qwen3-8B",
  "endpoint_id": 123,
  "template_hash": "abc123def456",
  "template_id": 456,
  "search_params": "gpu_name=RTX_3090 rentable=true",
  "launch_args": "--env VAR=value",
  "min_load": 1,
  "target_util": 0.9,
  "cold_mult": 3,
  "cold_workers": 3,
  "max_workers": 20,
  "test_workers": 3,
  "gpu_ram": 24
}
'
import requests

url = "https://console.vast.ai/api/v0/workergroups"

payload = {
"endpoint_name": "vLLM-Qwen3-8B",
"endpoint_id": 123,
"template_hash": "abc123def456",
"template_id": 456,
"search_params": "gpu_name=RTX_3090 rentable=true",
"launch_args": "--env VAR=value",
"min_load": 1,
"target_util": 0.9,
"cold_mult": 3,
"cold_workers": 3,
"max_workers": 20,
"test_workers": 3,
"gpu_ram": 24
}
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({
endpoint_name: 'vLLM-Qwen3-8B',
endpoint_id: 123,
template_hash: 'abc123def456',
template_id: 456,
search_params: 'gpu_name=RTX_3090 rentable=true',
launch_args: '--env VAR=value',
min_load: 1,
target_util: 0.9,
cold_mult: 3,
cold_workers: 3,
max_workers: 20,
test_workers: 3,
gpu_ram: 24
})
};

fetch('https://console.vast.ai/api/v0/workergroups', 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/workergroups",
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([
'endpoint_name' => 'vLLM-Qwen3-8B',
'endpoint_id' => 123,
'template_hash' => 'abc123def456',
'template_id' => 456,
'search_params' => 'gpu_name=RTX_3090 rentable=true',
'launch_args' => '--env VAR=value',
'min_load' => 1,
'target_util' => 0.9,
'cold_mult' => 3,
'cold_workers' => 3,
'max_workers' => 20,
'test_workers' => 3,
'gpu_ram' => 24
]),
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/workergroups"

payload := strings.NewReader("{\n \"endpoint_name\": \"vLLM-Qwen3-8B\",\n \"endpoint_id\": 123,\n \"template_hash\": \"abc123def456\",\n \"template_id\": 456,\n \"search_params\": \"gpu_name=RTX_3090 rentable=true\",\n \"launch_args\": \"--env VAR=value\",\n \"min_load\": 1,\n \"target_util\": 0.9,\n \"cold_mult\": 3,\n \"cold_workers\": 3,\n \"max_workers\": 20,\n \"test_workers\": 3,\n \"gpu_ram\": 24\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/workergroups")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endpoint_name\": \"vLLM-Qwen3-8B\",\n \"endpoint_id\": 123,\n \"template_hash\": \"abc123def456\",\n \"template_id\": 456,\n \"search_params\": \"gpu_name=RTX_3090 rentable=true\",\n \"launch_args\": \"--env VAR=value\",\n \"min_load\": 1,\n \"target_util\": 0.9,\n \"cold_mult\": 3,\n \"cold_workers\": 3,\n \"max_workers\": 20,\n \"test_workers\": 3,\n \"gpu_ram\": 24\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://console.vast.ai/api/v0/workergroups")

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 \"endpoint_name\": \"vLLM-Qwen3-8B\",\n \"endpoint_id\": 123,\n \"template_hash\": \"abc123def456\",\n \"template_id\": 456,\n \"search_params\": \"gpu_name=RTX_3090 rentable=true\",\n \"launch_args\": \"--env VAR=value\",\n \"min_load\": 1,\n \"target_util\": 0.9,\n \"cold_mult\": 3,\n \"cold_workers\": 3,\n \"max_workers\": 20,\n \"test_workers\": 3,\n \"gpu_ram\": 24\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "id": 789
}
{
"success": false,
"error": "invalid_args",
"msg": "Please assign your workergroup to a valid endpoint identifier"
}
{
"success": false,
"error": "<string>",
"msg": "<string>"
}
{
"detail": "API requests too frequent endpoint threshold=4.0"
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Body

application/json
endpoint_name
string

Name of the endpoint group

Example:

"vLLM-Qwen3-8B"

endpoint_id
integer

ID of existing endpoint group (alternative to endpoint_name)

Example:

123

template_hash
string

Hash ID of template to use for worker instances

Example:

"abc123def456"

template_id
integer

ID of template (alternative to template_hash)

Example:

456

search_params
string
default:verified=true rentable=true rented=false

Search query for finding worker instances (alternative to template)

Example:

"gpu_name=RTX_3090 rentable=true"

launch_args
string

Additional launch arguments for worker instances

Example:

"--env VAR=value"

min_load
number
default:1

Minimum load threshold for scaling

Example:

1

target_util
number
default:0.9

Target GPU utilization

Example:

0.9

cold_mult
number
default:3

Cold start multiplier

Example:

3

cold_workers
integer
default:3

Number of cold workers to maintain

Example:

3

max_workers
integer
default:20

Maximum number of worker instances

Example:

20

test_workers
integer
default:3

Number of test workers

Example:

3

gpu_ram
integer
default:24

Minimum GPU RAM in GB

Example:

24

Response

Successfully created workergroup

success
boolean
Example:

true

id
integer

ID of created autoscaling job

Example:

789