Vast.ai API
Search
search offers
1 min
code examples curl location request put 'https //console vast ai/api/v0/search/asks/' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{"body" {"q" {"verified" {},"rentable" {},"external" {},"rented" {},"reliability2" {},"num gpus" {},"gpu name" {},"cuda max good" {},"gpu ram" {},"dlperf per dphtotal" {},"inet down" {},"inet up" {},"direct port count" {},"geolocation" {},"bw nvlink" {},"compute cap" {},"cpu arch" {},"cpu cores" {},"cpu ghz" {},"datacenter" {},"disk bw" {},"dlperf" {},"dlperf usd" {},"driver version" {},"duration" {},"flops usd" {},"gpu arch" {},"gpu max power" {},"gpu max temp" {},"gpu mem bw" {},"gpu total ram" {},"gpu frac" {},"gpu display active" {},"has avx" {},"pci gen" {},"storage cost" {},"static ip" {},"total flops" {},"ubuntu version" {},"vms enabled" {},"machine id" {}}}}'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "body" { "q" { "verified" {}, "rentable" {}, "external" {}, "rented" {}, "reliability2" {}, "num gpus" {}, "gpu name" {}, "cuda max good" {}, "gpu ram" {}, "dlperf per dphtotal" {}, "inet down" {}, "inet up" {}, "direct port count" {}, "geolocation" {}, "bw nvlink" {}, "compute cap" {}, "cpu arch" {}, "cpu cores" {}, "cpu ghz" {}, "datacenter" {}, "disk bw" {}, "dlperf" {}, "dlperf usd" {}, "driver version" {}, "duration" {}, "flops usd" {}, "gpu arch" {}, "gpu max power" {}, "gpu max temp" {}, "gpu mem bw" {}, "gpu total ram" {}, "gpu frac" {}, "gpu display active" {}, "has avx" {}, "pci gen" {}, "storage cost" {}, "static ip" {}, "total flops" {}, "ubuntu version" {}, "vms enabled" {}, "machine id" {} } } }); var requestoptions = { method 'put', headers myheaders, body raw, redirect 'follow' }; fetch("https //console vast ai/api/v0/search/asks/", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //console vast ai/api/v0/search/asks/") https = net http new(url host, url port) https use ssl = true request = net http put new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "body" { "q" { "verified" {}, "rentable" {}, "external" {}, "rented" {}, "reliability2" {}, "num gpus" {}, "gpu name" {}, "cuda max good" {}, "gpu ram" {}, "dlperf per dphtotal" {}, "inet down" {}, "inet up" {}, "direct port count" {}, "geolocation" {}, "bw nvlink" {}, "compute cap" {}, "cpu arch" {}, "cpu cores" {}, "cpu ghz" {}, "datacenter" {}, "disk bw" {}, "dlperf" {}, "dlperf usd" {}, "driver version" {}, "duration" {}, "flops usd" {}, "gpu arch" {}, "gpu max power" {}, "gpu max temp" {}, "gpu mem bw" {}, "gpu total ram" {}, "gpu frac" {}, "gpu display active" {}, "has avx" {}, "pci gen" {}, "storage cost" {}, "static ip" {}, "total flops" {}, "ubuntu version" {}, "vms enabled" {}, "machine id" {} } } }) response = https request(request) puts response read body import requests import json url = "https //console vast ai/api/v0/search/asks/" payload = json dumps({ "body" { "q" { "verified" {}, "rentable" {}, "external" {}, "rented" {}, "reliability2" {}, "num gpus" {}, "gpu name" {}, "cuda max good" {}, "gpu ram" {}, "dlperf per dphtotal" {}, "inet down" {}, "inet up" {}, "direct port count" {}, "geolocation" {}, "bw nvlink" {}, "compute cap" {}, "cpu arch" {}, "cpu cores" {}, "cpu ghz" {}, "datacenter" {}, "disk bw" {}, "dlperf" {}, "dlperf usd" {}, "driver version" {}, "duration" {}, "flops usd" {}, "gpu arch" {}, "gpu max power" {}, "gpu max temp" {}, "gpu mem bw" {}, "gpu total ram" {}, "gpu frac" {}, "gpu display active" {}, "has avx" {}, "pci gen" {}, "storage cost" {}, "static ip" {}, "total flops" {}, "ubuntu version" {}, "vms enabled" {}, "machine id" {} } } }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("put", url, headers=headers, data=payload) print(response text) responses // successful search response { "success" true, "offers" \[ { "id" 0, "cuda max good" 0, "num gpus" 0, "gpu name" "", "pcie bw" 0, "cpu cores effective" 0, "cpu ram" 0, "disk space" 0, "dph total" 0, "dlperf" 0, "dlperf per dphtotal" 0, "inet up" 0, "inet down" 0, "reliability2" 0, "verified" false, "rentable" false, "rented" false, "machine id" 0, "geolocation" "", "direct port count" 0, "max bid" 0, "min bid" 0, "bw nvlink" 0, "compute cap" 0, "cpu arch" "", "gpu arch" "", "driver version" "", "ubuntu version" "" } ] }// bad request invalid query parameters { "success" false, "error" "", "msg" "" }// unauthorized invalid or missing api key { "success" false, "error" "", "msg" "" }// too many requests { "success" false, "error" "", "msg" "" }