Cost Summary
curl --request GET \
--url http://{host}:{port}/{basePath}/analytics/cost \
--header 'Authorization: <api-key>'import requests
url = "http://{host}:{port}/{basePath}/analytics/cost"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('http://{host}:{port}/{basePath}/analytics/cost', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://{host}:{port}/{basePath}/analytics/cost",
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>"
],
]);
$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 := "http://{host}:{port}/{basePath}/analytics/cost"
req, _ := http.NewRequest("GET", url, nil)
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("http://{host}:{port}/{basePath}/analytics/cost")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://{host}:{port}/{basePath}/analytics/cost")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"apiVersion": "v1",
"kind": "CostSummary",
"spec": {
"periodStart": "2026-08-26T14:00:00Z",
"periodEnd": "2026-09-25T14:00:00Z",
"totalLLMCost": 18.72,
"incidentCount": 312,
"costPerIncident": 0.06
}
}
Analytics
Custo
Retorna o gasto de LLM que os controllers registraram por incidente — custo total, quantidade de incidentes e custo por incidente para um namespace e janela
GET
/
analytics
/
cost
Cost Summary
curl --request GET \
--url http://{host}:{port}/{basePath}/analytics/cost \
--header 'Authorization: <api-key>'import requests
url = "http://{host}:{port}/{basePath}/analytics/cost"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('http://{host}:{port}/{basePath}/analytics/cost', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://{host}:{port}/{basePath}/analytics/cost",
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>"
],
]);
$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 := "http://{host}:{port}/{basePath}/analytics/cost"
req, _ := http.NewRequest("GET", url, nil)
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("http://{host}:{port}/{basePath}/analytics/cost")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://{host}:{port}/{basePath}/analytics/cost")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"apiVersion": "v1",
"kind": "CostSummary",
"spec": {
"periodStart": "2026-08-26T14:00:00Z",
"periodEnd": "2026-09-25T14:00:00Z",
"totalLLMCost": 18.72,
"incidentCount": 312,
"costPerIncident": 0.06
}
}
string
Namespace do Kubernetes cujo ledger ler. Vazio agrega o ledger de todos os namespaces.
string
Data inicial no formato RFC3339
string
Data final no formato RFC3339 (padrão: agora). A janela padrão é de 30 dias.
Campos do Resumo
| Campo | Descrição |
|---|---|
periodStart / periodEnd | Limites da janela |
totalLLMCost | Soma do estimatedCostUSD de cada incidente registrado dentro da janela (entradas sem recordedAt, escritas antes do carimbo existir, sempre contam) |
incidentCount | Incidentes com entrada no ledger dentro da janela |
costPerIncident | totalLLMCost / incidentCount |
chatcli-cost-ledger por namespace; veja Capacidade, Ruído e Custo para o formato e o override de preços.
{
"apiVersion": "v1",
"kind": "CostSummary",
"spec": {
"periodStart": "2026-08-26T14:00:00Z",
"periodEnd": "2026-09-25T14:00:00Z",
"totalLLMCost": 18.72,
"incidentCount": 312,
"costPerIncident": 0.06
}
}
Autorizações
Bearer token issued by the operator. Format: Authorization: Bearer <token>.
Parâmetros de consulta
Ledger to read. Empty aggregates every namespace.
Start date (RFC3339).
End date (RFC3339). Default: now. Default window: 30 days.