Compute recommendations
Get compute recommendation
Returns the latest compute recommendation for a resource owned by the tenant selected by the X-CostGraph-Tenant-ID header
GET
/
api
/
v1
/
tenant
/
compute
/
recommendations
/
{resource_type}
/
{resource_id}
Get compute recommendation
curl --request GET \
--url https://api.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id} \
--header 'Authorization: <api-key>' \
--header 'X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>'import requests
url = "https://api.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}"
headers = {
"X-CostGraph-Tenant-ID": "<x-costgraph-tenant-id>",
"Authorization": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-CostGraph-Tenant-ID': '<x-costgraph-tenant-id>', Authorization: '<api-key>'}
};
fetch('https://api.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}', 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.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>"
],
]);
$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.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
req.Header.Add("Authorization", "<api-key>")
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.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}")
.header("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-CostGraph-Tenant-ID"] = '<x-costgraph-tenant-id>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"capabilities": {
"check_agent_status": true
},
"cross_cloud_alternatives": [
{
"instance_type": "<string>",
"monthly_cost_usd": 123,
"provider": "<string>",
"ram_gb": 123,
"reason": "<string>",
"region": "<string>",
"risk": "<string>",
"savings_monthly_usd": 123,
"savings_percent": 123,
"vcpu": 123,
"distance_km": 123,
"latency_p95_ms": 123
}
],
"diagnostics": {
"coverage_by_signal": {},
"missing_metrics": [
"<string>"
],
"projected_threshold_at": "<string>",
"reason_codes": [
"<string>"
],
"summary_metrics": {
"cpu_util_p95": 123,
"cpu_util_p99": 123,
"disk_utilization_p95": 123,
"mem_used_p99_bytes": 123,
"mem_used_p99_gb": 123,
"network_bytes_per_second_p95": 123,
"oom_kills_increase": 123,
"observation_window_seconds": 123
}
},
"lifecycle": {
"agent_last_seen_at": "<string>",
"agent_reporting": true,
"metric_warmup_status": "ready",
"registered_at": "<string>",
"metric_warmup_complete_at": "<string>",
"next_cycle_at": "<string>"
},
"recommendation": {},
"resource": {
"active": true,
"architecture": "<string>",
"availability_zone": "<string>",
"instance_type": "<string>",
"name": "<string>",
"operating_system": "<string>",
"provider": "<string>",
"ram_gb": 123,
"region": "<string>",
"usage_type": "<string>",
"vcpu": 123
},
"resource_id": "<string>",
"resource_type": "<string>",
"state": "pending_first_run",
"action": "UPSIZE",
"algorithm_version": "<string>",
"apply_plan": {
"current_instance_type": "<string>",
"modes": [
{
"kind": "console",
"label": "<string>"
}
],
"provider": "<string>",
"provider_resource_id": "<string>",
"region": "<string>",
"requires_stop": true,
"resource_name": "<string>",
"target_instance_type": "<string>",
"availability_zone": "<string>",
"operating_system": "<string>"
},
"confidence": "low",
"coverage": 123,
"coverage_threshold": 123,
"cross_cloud_opportunity": {
"instance_type": "<string>",
"monthly_cost_usd": 123,
"provider": "<string>",
"ram_gb": 123,
"reason": "<string>",
"region": "<string>",
"risk": "<string>",
"savings_monthly_usd": 123,
"savings_percent": 123,
"vcpu": 123,
"distance_km": 123,
"latency_p95_ms": 123
},
"current_monthly_cost": 123,
"generated_at": "<string>",
"reason": "<string>",
"recommended_instance_type": "<string>",
"recommended_monthly_cost": 123,
"recommended_ram_gb": 123,
"recommended_vcpu": 123,
"savings_annual_usd": 123,
"savings_monthly_usd": 123
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Authorizations
Enter "Bearer {token}"
Headers
Tenant ID
Path Parameters
Resource type, currently virtual_machine
Resource ID
Was this page helpful?
⌘I
Get compute recommendation
curl --request GET \
--url https://api.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id} \
--header 'Authorization: <api-key>' \
--header 'X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>'import requests
url = "https://api.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}"
headers = {
"X-CostGraph-Tenant-ID": "<x-costgraph-tenant-id>",
"Authorization": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-CostGraph-Tenant-ID': '<x-costgraph-tenant-id>', Authorization: '<api-key>'}
};
fetch('https://api.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}', 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.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>"
],
]);
$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.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
req.Header.Add("Authorization", "<api-key>")
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.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}")
.header("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/compute/recommendations/{resource_type}/{resource_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-CostGraph-Tenant-ID"] = '<x-costgraph-tenant-id>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"capabilities": {
"check_agent_status": true
},
"cross_cloud_alternatives": [
{
"instance_type": "<string>",
"monthly_cost_usd": 123,
"provider": "<string>",
"ram_gb": 123,
"reason": "<string>",
"region": "<string>",
"risk": "<string>",
"savings_monthly_usd": 123,
"savings_percent": 123,
"vcpu": 123,
"distance_km": 123,
"latency_p95_ms": 123
}
],
"diagnostics": {
"coverage_by_signal": {},
"missing_metrics": [
"<string>"
],
"projected_threshold_at": "<string>",
"reason_codes": [
"<string>"
],
"summary_metrics": {
"cpu_util_p95": 123,
"cpu_util_p99": 123,
"disk_utilization_p95": 123,
"mem_used_p99_bytes": 123,
"mem_used_p99_gb": 123,
"network_bytes_per_second_p95": 123,
"oom_kills_increase": 123,
"observation_window_seconds": 123
}
},
"lifecycle": {
"agent_last_seen_at": "<string>",
"agent_reporting": true,
"metric_warmup_status": "ready",
"registered_at": "<string>",
"metric_warmup_complete_at": "<string>",
"next_cycle_at": "<string>"
},
"recommendation": {},
"resource": {
"active": true,
"architecture": "<string>",
"availability_zone": "<string>",
"instance_type": "<string>",
"name": "<string>",
"operating_system": "<string>",
"provider": "<string>",
"ram_gb": 123,
"region": "<string>",
"usage_type": "<string>",
"vcpu": 123
},
"resource_id": "<string>",
"resource_type": "<string>",
"state": "pending_first_run",
"action": "UPSIZE",
"algorithm_version": "<string>",
"apply_plan": {
"current_instance_type": "<string>",
"modes": [
{
"kind": "console",
"label": "<string>"
}
],
"provider": "<string>",
"provider_resource_id": "<string>",
"region": "<string>",
"requires_stop": true,
"resource_name": "<string>",
"target_instance_type": "<string>",
"availability_zone": "<string>",
"operating_system": "<string>"
},
"confidence": "low",
"coverage": 123,
"coverage_threshold": 123,
"cross_cloud_opportunity": {
"instance_type": "<string>",
"monthly_cost_usd": 123,
"provider": "<string>",
"ram_gb": 123,
"reason": "<string>",
"region": "<string>",
"risk": "<string>",
"savings_monthly_usd": 123,
"savings_percent": 123,
"vcpu": 123,
"distance_km": 123,
"latency_p95_ms": 123
},
"current_monthly_cost": 123,
"generated_at": "<string>",
"reason": "<string>",
"recommended_instance_type": "<string>",
"recommended_monthly_cost": 123,
"recommended_ram_gb": 123,
"recommended_vcpu": 123,
"savings_annual_usd": 123,
"savings_monthly_usd": 123
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}