Get project analytics
curl --request GET \
--url https://api.uselemma.ai/projects/{project_id}/analytics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.uselemma.ai/projects/{project_id}/analytics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.uselemma.ai/projects/{project_id}/analytics', 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.uselemma.ai/projects/{project_id}/analytics",
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.uselemma.ai/projects/{project_id}/analytics"
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.uselemma.ai/projects/{project_id}/analytics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselemma.ai/projects/{project_id}/analytics")
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{
"view": "base",
"payload": {
"traces": [
{
"date": "<string>",
"value": 123
}
],
"errors": [
{
"date": "<string>",
"span_errors": 123,
"failed_runs": 123,
"root_status_known": 123,
"root_absent": 123,
"traces": 123
}
],
"tokens": [
{
"date": "<string>",
"input_tokens": 123,
"output_tokens": 123
}
],
"cost": [
{
"estimated_cost_usd": 123,
"priced_token_share": 123,
"priced_tokens": 123,
"total_tokens": 123,
"unpriced_models": [
"<string>"
],
"pricing_fetched_at": "2023-11-07T05:31:56Z",
"cost_source": "stored",
"cost_lower_bound": true,
"cost_lower_bound_reasons": [
"unpriced_models"
],
"model_breakdown_truncated": true,
"date": "<string>",
"traces": 123
}
],
"cost_by_model": [
{
"date": "<string>",
"values": {},
"coverage": "all",
"attributed_traces": 123,
"traces": 123
}
],
"cost_by_model_source": "query_time",
"cost_by_model_coverage": "all"
}
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}Projects
Get project analytics
Returns one analytics payload selected by the required view discriminator. Specialized views do not compute unrequested panels. Cost figures are Lemma estimates from observed token counts and public LiteLLM list prices — not invoice amounts. Backfilled rows carry the price as of the backfill run, not the price as of the call.
GET
/
projects
/
{project_id}
/
analytics
Get project analytics
curl --request GET \
--url https://api.uselemma.ai/projects/{project_id}/analytics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.uselemma.ai/projects/{project_id}/analytics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.uselemma.ai/projects/{project_id}/analytics', 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.uselemma.ai/projects/{project_id}/analytics",
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.uselemma.ai/projects/{project_id}/analytics"
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.uselemma.ai/projects/{project_id}/analytics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselemma.ai/projects/{project_id}/analytics")
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{
"view": "base",
"payload": {
"traces": [
{
"date": "<string>",
"value": 123
}
],
"errors": [
{
"date": "<string>",
"span_errors": 123,
"failed_runs": 123,
"root_status_known": 123,
"root_absent": 123,
"traces": 123
}
],
"tokens": [
{
"date": "<string>",
"input_tokens": 123,
"output_tokens": 123
}
],
"cost": [
{
"estimated_cost_usd": 123,
"priced_token_share": 123,
"priced_tokens": 123,
"total_tokens": 123,
"unpriced_models": [
"<string>"
],
"pricing_fetched_at": "2023-11-07T05:31:56Z",
"cost_source": "stored",
"cost_lower_bound": true,
"cost_lower_bound_reasons": [
"unpriced_models"
],
"model_breakdown_truncated": true,
"date": "<string>",
"traces": 123
}
],
"cost_by_model": [
{
"date": "<string>",
"values": {},
"coverage": "all",
"attributed_traces": 123,
"traces": 123
}
],
"cost_by_model_source": "query_time",
"cost_by_model_coverage": "all"
}
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>"
}