curl --request POST \
--url https://run.vast.ai/route/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endpoint": "vLLM-Qwen3-8B",
"cost": 242
}
'import requests
url = "https://run.vast.ai/route/"
payload = {
"endpoint": "vLLM-Qwen3-8B",
"cost": 242
}
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: 'vLLM-Qwen3-8B', cost: 242})
};
fetch('https://run.vast.ai/route/', 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://run.vast.ai/route/",
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' => 'vLLM-Qwen3-8B',
'cost' => 242
]),
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://run.vast.ai/route/"
payload := strings.NewReader("{\n \"endpoint\": \"vLLM-Qwen3-8B\",\n \"cost\": 242\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://run.vast.ai/route/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endpoint\": \"vLLM-Qwen3-8B\",\n \"cost\": 242\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://run.vast.ai/route/")
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\": \"vLLM-Qwen3-8B\",\n \"cost\": 242\n}"
response = http.request(request)
puts response.read_body{
"endpoint": "vLLM-Qwen3-8B",
"url": "http://192.168.1.10:8000",
"cost": 242,
"reqnum": 12345,
"signature": "a1b2c3d4e5f60708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20",
"__request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}{
"error": "Invalid endpoint or missing required parameters"
}{
"error": "Authentication failed"
}route
Calls on the serverless engine to retrieve a GPU instance address within your endpoint for processing a request. The engine will return either a ready worker URL or status information if no workers are available.
CLI Usage: vastai route <endpoint> <cost>
curl --request POST \
--url https://run.vast.ai/route/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endpoint": "vLLM-Qwen3-8B",
"cost": 242
}
'import requests
url = "https://run.vast.ai/route/"
payload = {
"endpoint": "vLLM-Qwen3-8B",
"cost": 242
}
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: 'vLLM-Qwen3-8B', cost: 242})
};
fetch('https://run.vast.ai/route/', 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://run.vast.ai/route/",
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' => 'vLLM-Qwen3-8B',
'cost' => 242
]),
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://run.vast.ai/route/"
payload := strings.NewReader("{\n \"endpoint\": \"vLLM-Qwen3-8B\",\n \"cost\": 242\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://run.vast.ai/route/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endpoint\": \"vLLM-Qwen3-8B\",\n \"cost\": 242\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://run.vast.ai/route/")
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\": \"vLLM-Qwen3-8B\",\n \"cost\": 242\n}"
response = http.request(request)
puts response.read_body{
"endpoint": "vLLM-Qwen3-8B",
"url": "http://192.168.1.10:8000",
"cost": 242,
"reqnum": 12345,
"signature": "a1b2c3d4e5f60708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20",
"__request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}{
"error": "Invalid endpoint or missing required parameters"
}{
"error": "Authentication failed"
}Authorizations
API key must be provided in the Authorization header
Body
Response
Success response - either worker assignment or status
- Worker Available
- No Worker Available
Same as the input parameter
"vLLM-Qwen3-8B"
The address of the worker instance to send the request to
"http://192.168.1.10:8000"
Same as the input parameter
242
Request number corresponding to this worker instance
12345
Cryptographic signature authenticating the response
"a1b2c3d4e5f60708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20"
Unique identifier generated by the server for this request
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"