Vast.ai API
Instances
show instance
1min
code examples curl location globoff 'https //console vast ai/api/v0/instances/{id}/' \\ \ header 'accept application/json' \\ \ header 'content type application/json'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var requestoptions = { method 'get', headers myheaders, redirect 'follow' }; fetch("https //console vast ai/api/v0/instances/{id}/", 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/instances/{id}/") https = net http new(url host, url port) https use ssl = true request = net http get new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" response = https request(request) puts response read body import requests import json url = "https //console vast ai/api/v0/instances/{id}/" payload = {} headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("get", url, headers=headers, data=payload) print(response text) responses // success response with instance details { "instances" { "id" 123, "ssh idx" "ssh1", "ssh host" "192 168 1 10", "ssh port" 22, "actual status" "running", "intended status" "running", "cur state" "active", "next state" "pending", "template id" 45, "template hash id" "abc123", "image uuid" "uuid 1234", "image args" " arg1 value", "image runtype" "ssh", "extra env" \[ "" ], "onstart" "init sh", "label" "instance 123", "jupyter token" "token123", "status msg" "running normally", "gpu util" 0 75, "gpu arch" "volta", "disk util" 75, "disk usage" 75, "gpu temp" 65, "cuda max good" 11 2, "driver version" "460 32 03", "public ipaddr" "203 0 113 1", "local ipaddrs" \[ "" ], "direct port end" 8001, "direct port start" 8000, "cpu util" 0 65, "mem usage" 4096, "mem limit" 8192, "vmem usage" 4096, "machine dir ssh port" 2222, "uptime mins" 120, "ports" \[ 0 ] } }// bad request – invalid instance id or invalid arguments { "success" false, "error" "", "msg" "" }// unauthorized – invalid or missing authentication { "success" false, "error" "", "msg" "" }// too many requests – api requests are too frequent { "detail" "api requests too frequent endpoint threshold=2 0" }