Vast.ai API
Instances

execute

1min
code examples curl location globoff request put 'https //console vast ai/api/v0/instances/command/{id}/' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "command" "" }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "command" "" }); var requestoptions = { method 'put', headers myheaders, body raw, redirect 'follow' }; fetch("https //console vast ai/api/v0/instances/command/{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/command/{id}/") 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({ "command" "" }) response = https request(request) puts response read body import requests import json url = "https //console vast ai/api/v0/instances/command/{id}/" payload = json dumps({ "command" "" }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("put", url, headers=headers, data=payload) print(response text) responses // command queued successfully { "success" true, "writeable path" "/workspace", "result url" "https //s3 amazonaws com/vast ai/instance logs/abc123 log", "msg" "command is executing, wait a few seconds and then view the result url" }// invalid request parameters { "success" false, "error" "", "msg" "invalid command given " }// unauthorized invalid or missing api key { "success" false, "error" "", "msg" "" }// forbidden user is blacklisted { "success" false, "error" "", "msg" "" }// too many requests { "detail" "api requests too frequent endpoint threshold=1 5" }// invalid json body { "success" false, "error" "invalid args", "msg" "invalid json body" }