Vast.ai API
Instances
create instance
1min
code examples curl location globoff request put 'https //console vast ai/api/v0/asks/{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 'put', headers myheaders, redirect 'follow' }; fetch("https //console vast ai/api/v0/asks/{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/asks/{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" response = https request(request) puts response read body import requests import json url = "https //console vast ai/api/v0/asks/{id}/" payload = {} headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("put", url, headers=headers, data=payload) print(response text) responses // instance created successfully { "success" true, "new contract" 1234568 }// bad request { "success" false, "error" "", "msg" "please set a bid price >= 0 001 and <= 128 0", "ask id" 1234567 }// unauthorized { "success" false, "error" "", "msg" "" }// forbidden { "success" false, "error" "not allowed", "msg" "hosts can only rent their own machines", "ask id" 1234567 }// offer not found { "success" false, "error" "no such ask", "msg" "instance type by id 1234567 is not available", "ask id" 1234567 }// offer no longer available { "success" false, "error" "no such ask", "msg" "instance type 1234567 is no longer available", "ask id" 1234567 }// too many requests { "detail" "api requests too frequent endpoint threshold=4 5" }