curl --request GET \
--url https://api.varg.ai/v2/analytics/breakdown \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.varg.ai/v2/analytics/breakdown"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.varg.ai/v2/analytics/breakdown', 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.varg.ai/v2/analytics/breakdown",
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.varg.ai/v2/analytics/breakdown"
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.varg.ai/v2/analytics/breakdown")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.varg.ai/v2/analytics/breakdown")
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{
"data": {
"group_by": [
"tool"
],
"sort": "spend",
"rows": [
{
"group": {},
"labels": {},
"spend_cents": 123,
"share": 123,
"charges": 123,
"jobs": 123,
"runs": 123,
"details": {},
"previous_spend_cents": 123,
"change_pct": 123
}
],
"other": {
"groups": 123,
"spend_cents": 123,
"share": 123,
"charges": 123,
"jobs": 123
},
"total": {
"spend_cents": 123,
"charges": 123,
"jobs": 123,
"runs": 123,
"groups": 123
}
},
"meta": {
"definition_version": "2026-09-28",
"data_as_of": "2023-11-07T05:31:56Z",
"money_unit": "cent",
"time_basis": "posted_at",
"attribution_scope": "full",
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z",
"timezone": "UTC",
"compare": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
},
"filters": {}
}
}{
"error": {
"code": "model_not_found",
"message": "Unknown model: flux-shnell",
"details": "<unknown>"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key or JWT"
}
}{
"error": {
"code": "model_not_found",
"message": "Unknown model: flux-shnell",
"details": "<unknown>"
}
}Spend breakdown
Spend ranked by one or two dimensions. Rows plus other always add up to total. Returns 400 too_many_groups when the grouping yields more than 5000 groups.
All analytics endpoints return { "data": ..., "meta": ... }. meta carries the resolved range
(from inclusive, to exclusive, ISO 8601 UTC), timezone, the comparison period, applied filters,
data_as_of, money_unit, time_basis and attribution_scope.
Amounts are whole credits; fields ending in _cents are credits (1 credit = 1 cent). Charges are counted
when they were posted to the ledger. On team accounts, non-members only see their own identity
dimensions (attribution_scope: self); others collapse into “Other …” groups.
With format=csv every row is exported (no other roll-up).
curl --request GET \
--url https://api.varg.ai/v2/analytics/breakdown \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.varg.ai/v2/analytics/breakdown"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.varg.ai/v2/analytics/breakdown', 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.varg.ai/v2/analytics/breakdown",
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.varg.ai/v2/analytics/breakdown"
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.varg.ai/v2/analytics/breakdown")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.varg.ai/v2/analytics/breakdown")
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{
"data": {
"group_by": [
"tool"
],
"sort": "spend",
"rows": [
{
"group": {},
"labels": {},
"spend_cents": 123,
"share": 123,
"charges": 123,
"jobs": 123,
"runs": 123,
"details": {},
"previous_spend_cents": 123,
"change_pct": 123
}
],
"other": {
"groups": 123,
"spend_cents": 123,
"share": 123,
"charges": 123,
"jobs": 123
},
"total": {
"spend_cents": 123,
"charges": 123,
"jobs": 123,
"runs": 123,
"groups": 123
}
},
"meta": {
"definition_version": "2026-09-28",
"data_as_of": "2023-11-07T05:31:56Z",
"money_unit": "cent",
"time_basis": "posted_at",
"attribution_scope": "full",
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z",
"timezone": "UTC",
"compare": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
},
"filters": {}
}
}{
"error": {
"code": "model_not_found",
"message": "Unknown model: flux-shnell",
"details": "<unknown>"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key or JWT"
}
}{
"error": {
"code": "model_not_found",
"message": "Unknown model: flux-shnell",
"details": "<unknown>"
}
}Authorizations
varg API key (varg_...). Get one at app.varg.ai
or run bunx vargai login. App sessions may alternatively send a
Supabase JWT.
Query Parameters
Range start, inclusive. YYYY-MM-DD (local midnight in timezone), a local date-time
(2026-09-01T09:30), or an ISO 8601 instant with offset. Default: to minus 30 days.
Ranges are limited to 366 days.
40Range end, exclusive. Same formats as from. Default is now.
40IANA timezone used for date-only bounds and calendar buckets. Default UTC.
64previous_period compares against the equal-length period right before from;
none disables comparison. Default is previous_period on /analytics/summary
and none elsewhere. Ignored when compare_from/compare_to are given.
previous_period, none Explicit comparison start. Must be sent together with compare_to.
40Explicit comparison end, exclusive. Must be sent together with compare_from.
40Filter by capability. Comma-separated tool keys (video, image, speech, music, render, pipeline, ...) or none. Up to 50 values.
4000Filter by model. Comma-separated model ids or none. Up to 50 values.
4000Filter by folder. Comma-separated folder ids or none (no folder). Up to 50 values.
4000Filter by the API key that started the run. Comma-separated key ids or none. Up to 50 values.
4000Filter by the person who started the run. Comma-separated user ids or none. Up to 50 values.
4000Filter by creator: api_key:<id> (a personal API key) or member:<id> (a person),
comma-separated, or none. Up to 50 values.
4000Filter by how the run was started. Comma-separated values of app (a person in the web app),
api (API key, SDK, CLI), mcp (an agent via MCP), internal (varg system keys), unknown.
4000Filter by the charged job's status. Comma-separated values of completed, failed,
cancelled, awaiting_confirmation, running, submitting, queued, unknown.
4000One or two dimensions, comma-separated (for example model or tool,source).
40Ranking metric. Default spend.
spend, charges, jobs, runs Rows to return before the rest is rolled into other. 1-200, default 20. Out-of-range values are clamped. Ignored for CSV, which exports every row.
1 <= x <= 200json (default) returns the { data, meta } envelope. csv returns the same rows as
text/csv with a Content-Disposition attachment filename. Amounts are in credits.
json, csv Was this page helpful?