Compare Costs
curl --request GET \
--url https://api.wistx.ai/v1/cost/compareimport requests
url = "https://api.wistx.ai/v1/cost/compare"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.wistx.ai/v1/cost/compare', 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://api.wistx.ai/v1/cost/compare",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.wistx.ai/v1/cost/compare"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.wistx.ai/v1/cost/compare")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/cost/compare")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"service_name": "EC2",
"resource_type": "t3.micro",
"comparison": [
{
"provider": "aws",
"region": "us-east-1",
"price": 0.0104,
"currency": "USD",
"unit": "hour"
},
{
"provider": "aws",
"region": "eu-west-1",
"price": 0.0116,
"currency": "USD",
"unit": "hour"
}
],
"cheapest": {
"provider": "aws",
"region": "us-east-1",
"price": 0.0104,
"currency": "USD",
"unit": "hour"
}
}
{
"detail": "service_name is required"
}
{
"detail": "Comparison failed: Database connection error"
}
Cost Search
Compare Costs
Compare costs across providers/regions
GET
/
v1
/
cost
/
compare
Compare Costs
curl --request GET \
--url https://api.wistx.ai/v1/cost/compareimport requests
url = "https://api.wistx.ai/v1/cost/compare"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.wistx.ai/v1/cost/compare', 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://api.wistx.ai/v1/cost/compare",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.wistx.ai/v1/cost/compare"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.wistx.ai/v1/cost/compare")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/cost/compare")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"service_name": "EC2",
"resource_type": "t3.micro",
"comparison": [
{
"provider": "aws",
"region": "us-east-1",
"price": 0.0104,
"currency": "USD",
"unit": "hour"
},
{
"provider": "aws",
"region": "eu-west-1",
"price": 0.0116,
"currency": "USD",
"unit": "hour"
}
],
"cheapest": {
"provider": "aws",
"region": "us-east-1",
"price": 0.0104,
"currency": "USD",
"unit": "hour"
}
}
{
"detail": "service_name is required"
}
{
"detail": "Comparison failed: Database connection error"
}
Compare costs across providers/regions
Endpoint
GET /v1/cost/compare
curl --request GET \
--url 'https://api.wistx.ai/v1/cost/compare?service_name=EC2&resource_type=t3.micro®ions=us-east-1®ions=eu-west-1&providers=aws&providers=gcp'
import requests
url = "https://api.wistx.ai/v1/cost/compare"
response = requests.get(
url,
params={
"service_name": "EC2",
"resource_type": "t3.micro",
"regions": ["us-east-1", "eu-west-1"],
"providers": ["aws", "gcp"]
}
)
data = response.json()
print(f"Cheapest: {data['cheapest']}")
const url = "https://api.wistx.ai/v1/cost/compare";
const params = new URLSearchParams({
service_name: "EC2",
resource_type: "t3.micro"
});
params.append("regions", "us-east-1");
params.append("regions", "eu-west-1");
params.append("providers", "aws");
params.append("providers", "gcp");
const response = await fetch(`${url}?${params}`);
const data = await response.json();
console.log(`Cheapest: ${JSON.stringify(data.cheapest)}`);
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
)
func main() {
baseURL := "https://api.wistx.ai/v1/cost/compare"
params := url.Values{}
params.Add("service_name", "EC2")
params.Add("resource_type", "t3.micro")
params.Add("regions", "us-east-1")
params.Add("regions", "eu-west-1")
params.Add("providers", "aws")
params.Add("providers", "gcp")
fullURL := baseURL + "?" + params.Encode()
resp, _ := http.Get(fullURL)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("Cheapest: %v\n", result["cheapest"])
}
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.wistx.ai/v1/cost/compare")
params = {
service_name: "EC2",
resource_type: "t3.micro",
regions: ["us-east-1", "eu-west-1"],
providers: ["aws", "gcp"]
}
url.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(url)
data = JSON.parse(response.body)
puts "Cheapest: #{data['cheapest']}"
<?php
$url = "https://api.wistx.ai/v1/cost/compare?" . http_build_query([
"service_name" => "EC2",
"resource_type" => "t3.micro",
"regions" => ["us-east-1", "eu-west-1"],
"providers" => ["aws", "gcp"]
]);
$response = file_get_contents($url);
$data = json_decode($response, true);
echo "Cheapest: " . json_encode($data['cheapest']);
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
public class CompareCosts {
public static void main(String[] args) throws Exception {
URL url = new URL("https://api.wistx.ai/v1/cost/compare?service_name=EC2&resource_type=t3.micro®ions=us-east-1®ions=eu-west-1&providers=aws&providers=gcp");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
StringBuilder response = new StringBuilder();
String responseLine;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
Gson gson = new Gson();
JsonObject data = gson.fromJson(response.toString(), JsonObject.class);
System.out.println("Cheapest: " + data.get("cheapest"));
}
}
Query Parameters
string
required
Service name to compare (e.g.,
EC2, RDS, S3).string
Resource type filter (e.g.,
t3.micro, db.t3.medium).array[string]
List of regions to compare (e.g.,
["us-east-1", "eu-west-1"]).array[string]
List of providers to compare (e.g.,
["aws", "gcp", "azure"]).Response
{
"service_name": "EC2",
"resource_type": "t3.micro",
"comparison": [
{
"provider": "aws",
"region": "us-east-1",
"price": 0.0104,
"currency": "USD",
"unit": "hour"
},
{
"provider": "aws",
"region": "eu-west-1",
"price": 0.0116,
"currency": "USD",
"unit": "hour"
}
],
"cheapest": {
"provider": "aws",
"region": "us-east-1",
"price": 0.0104,
"currency": "USD",
"unit": "hour"
}
}
{
"detail": "service_name is required"
}
{
"detail": "Comparison failed: Database connection error"
}
Related Endpoints
- Search Costs - Search cost data
- Get Costs by Provider - Get costs by provider
- Get Optimization Opportunities - Find optimization opportunities