Skip to main content
POST
/
route
route
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

Authorization
string
header
required

API key must be provided in the Authorization header

Body

application/json
endpoint
string
required

Name of the endpoint

Example:

"vLLM-Qwen3-8B"

cost
number<float>
default:100
required

The estimated compute resources for the request

Required range: x >= 0
Example:

242

Response

Success response - either worker assignment or status

endpoint
string

Same as the input parameter

Example:

"vLLM-Qwen3-8B"

url
string

The address of the worker instance to send the request to

Example:

"http://192.168.1.10:8000"

cost
number

Same as the input parameter

Example:

242

reqnum
integer

Request number corresponding to this worker instance

Example:

12345

signature
string

Cryptographic signature authenticating the response

Example:

"a1b2c3d4e5f60708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20"

__request_id
string

Unique identifier generated by the server for this request

Example:

"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"