Read the AI usage breakdown
curl --request GET \
--url https://api.zelto.ai/v1/usage/ai \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.zelto.ai/v1/usage/ai"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.zelto.ai/v1/usage/ai', 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.zelto.ai/v1/usage/ai",
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: Bearer <token>"
],
]);
$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.zelto.ai/v1/usage/ai"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.zelto.ai/v1/usage/ai")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zelto.ai/v1/usage/ai")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"aiUsage": {
"month": "2023-12-25",
"currency": "USD",
"unit": "micros",
"total": {
"costMicros": 123,
"modelCalls": 123,
"inputTokens": 123,
"outputTokens": 123,
"callsAnalyzed": 123
},
"byMonitor": [
{
"costMicros": 123,
"modelCalls": 123,
"inputTokens": 123,
"outputTokens": 123,
"callsAnalyzed": 123,
"monitorId": "<string>",
"name": "<string>",
"kind": "monitor"
}
],
"byActivity": [
{
"costMicros": 123,
"modelCalls": 123,
"inputTokens": 123,
"outputTokens": 123,
"callsAnalyzed": 123,
"activity": "monitor_runs",
"flows": [
"<string>"
]
}
],
"byModel": [
{
"costMicros": 123,
"modelCalls": 123,
"inputTokens": 123,
"outputTokens": 123,
"callsAnalyzed": 123,
"model": "<string>",
"label": "<string>",
"rate": {
"inputPerMillionUsd": 123,
"outputPerMillionUsd": 123
}
}
],
"byDay": [
{
"costMicros": 123,
"modelCalls": 123,
"inputTokens": 123,
"outputTokens": 123,
"callsAnalyzed": 123,
"date": "2023-12-25"
}
]
}
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"hint": "<string>",
"parameter": "<string>",
"unknown": [
"<string>"
],
"valid": [
"<string>"
],
"details": {},
"feedback": {
"endpoint": "<string>",
"method": "POST",
"message": "<string>"
},
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Usage
Read the AI usage breakdown
What the authenticated organization’s Zelto-paid AI usage was spent on in a UTC month, in USD micros: the total (the ‘AI usage at cost’ charge on custom agreements) and the same amount by monitor, by activity, by model (tokens and rates), and by day. Mirrors the breakdown on the Usage page and the get_ai_usage_breakdown MCP tool.
GET
/
v1
/
usage
/
ai
Read the AI usage breakdown
curl --request GET \
--url https://api.zelto.ai/v1/usage/ai \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.zelto.ai/v1/usage/ai"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.zelto.ai/v1/usage/ai', 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.zelto.ai/v1/usage/ai",
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: Bearer <token>"
],
]);
$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.zelto.ai/v1/usage/ai"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.zelto.ai/v1/usage/ai")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zelto.ai/v1/usage/ai")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"aiUsage": {
"month": "2023-12-25",
"currency": "USD",
"unit": "micros",
"total": {
"costMicros": 123,
"modelCalls": 123,
"inputTokens": 123,
"outputTokens": 123,
"callsAnalyzed": 123
},
"byMonitor": [
{
"costMicros": 123,
"modelCalls": 123,
"inputTokens": 123,
"outputTokens": 123,
"callsAnalyzed": 123,
"monitorId": "<string>",
"name": "<string>",
"kind": "monitor"
}
],
"byActivity": [
{
"costMicros": 123,
"modelCalls": 123,
"inputTokens": 123,
"outputTokens": 123,
"callsAnalyzed": 123,
"activity": "monitor_runs",
"flows": [
"<string>"
]
}
],
"byModel": [
{
"costMicros": 123,
"modelCalls": 123,
"inputTokens": 123,
"outputTokens": 123,
"callsAnalyzed": 123,
"model": "<string>",
"label": "<string>",
"rate": {
"inputPerMillionUsd": 123,
"outputPerMillionUsd": 123
}
}
],
"byDay": [
{
"costMicros": 123,
"modelCalls": 123,
"inputTokens": 123,
"outputTokens": 123,
"callsAnalyzed": 123,
"date": "2023-12-25"
}
]
}
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"hint": "<string>",
"parameter": "<string>",
"unknown": [
"<string>"
],
"valid": [
"<string>"
],
"details": {},
"feedback": {
"endpoint": "<string>",
"method": "POST",
"message": "<string>"
},
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
