Python SDK
import httpx
resp = httpx.get(
"https://api.decimal.ai/api/v1/traces/stats",
headers={"Authorization": "Bearer dai_sk_..."},
params={"agent_name": "my-agent"},
)
resp.raise_for_status()
stats = resp.json()decimalai traces stats --agent-name my-agentconst options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.decimal.ai/api/v1/traces/stats', 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.decimal.ai/api/v1/traces/stats",
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.decimal.ai/api/v1/traces/stats"
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.decimal.ai/api/v1/traces/stats")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decimal.ai/api/v1/traces/stats")
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{
"total_traces": 1250,
"success_count": 1180,
"error_count": 70,
"total_input_tokens": 500000,
"total_output_tokens": 250000,
"total_tokens": 750000,
"total_llm_calls": 3200,
"total_cost_usd": 12.45,
"avg_latency_ms": 1250.5,
"models_used": {
"gpt-4o": 2800,
"claude-3-sonnet": 400
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}traces
Aggregate stats across traces
Aggregate statistics for traces matching the given filters.
Returns token totals, estimated costs, latency percentiles, model breakdown, and daily time-series data.
GET
/
api
/
v1
/
traces
/
stats
Python SDK
import httpx
resp = httpx.get(
"https://api.decimal.ai/api/v1/traces/stats",
headers={"Authorization": "Bearer dai_sk_..."},
params={"agent_name": "my-agent"},
)
resp.raise_for_status()
stats = resp.json()decimalai traces stats --agent-name my-agentconst options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.decimal.ai/api/v1/traces/stats', 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.decimal.ai/api/v1/traces/stats",
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.decimal.ai/api/v1/traces/stats"
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.decimal.ai/api/v1/traces/stats")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decimal.ai/api/v1/traces/stats")
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{
"total_traces": 1250,
"success_count": 1180,
"error_count": 70,
"total_input_tokens": 500000,
"total_output_tokens": 250000,
"total_tokens": 750000,
"total_llm_calls": 3200,
"total_cost_usd": 12.45,
"avg_latency_ms": 1250.5,
"models_used": {
"gpt-4o": 2800,
"claude-3-sonnet": 400
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Enter your API key (e.g. dai_sk_test_key_001)
Query Parameters
When false, exclude platform-harness fixture agents from the aggregates — the UI's default. Defaults to true for API back-compat. Ignored when agent_name is set.
Cookies
Response
Successful Response
The response is of type Response Get Trace Stats Api V1 Traces Stats Get · object.