Get Usage Breakdown
curl --request GET \
--url https://api.eesi.ai/v1/organizations/usage/breakdown \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.eesi.ai/v1/organizations/usage/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.eesi.ai/v1/organizations/usage/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.eesi.ai/v1/organizations/usage/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.eesi.ai/v1/organizations/usage/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.eesi.ai/v1/organizations/usage/breakdown")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eesi.ai/v1/organizations/usage/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{
"period_start": "<string>",
"period_end": "<string>",
"charged_cents": 123,
"comped_cents": 123,
"spend_cents": 123,
"entries": 123,
"billing_exempt": true,
"unattributed": {
"calls": 123,
"charged_cents": 123,
"comped_cents": 123,
"spend_cents": 123
},
"by_kind": [
{
"kind": "<string>",
"calls": 123,
"quantity": 123,
"charged_cents": 123,
"comped_cents": 123,
"spend_cents": 123
}
],
"by_model": [
{
"kind": "<string>",
"calls": 123,
"quantity": 123,
"charged_cents": 123,
"comped_cents": 123,
"spend_cents": 123,
"model": "<string>"
}
],
"by_api_key": [
{
"api_key_id": 123,
"name": "<string>",
"key_prefix": "<string>",
"is_active": true,
"calls": 123,
"charged_cents": 123,
"comped_cents": 123,
"spend_cents": 123,
"last_four": "<string>",
"last_used_at": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Usage and billing
Get Usage Breakdown
What the organization’s work cost, by kind, by model, and by API key.
Available to every organization, including exempt and unlimited ones —
that is the point. Their balance never moves, so charged_cents is 0 and
every other figure would be too if the breakdown read debits alone;
comped_cents carries what the same traffic would have cost, and
spend_cents is the number to look at either way.
GET
/
v1
/
organizations
/
usage
/
breakdown
Get Usage Breakdown
curl --request GET \
--url https://api.eesi.ai/v1/organizations/usage/breakdown \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.eesi.ai/v1/organizations/usage/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.eesi.ai/v1/organizations/usage/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.eesi.ai/v1/organizations/usage/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.eesi.ai/v1/organizations/usage/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.eesi.ai/v1/organizations/usage/breakdown")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eesi.ai/v1/organizations/usage/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{
"period_start": "<string>",
"period_end": "<string>",
"charged_cents": 123,
"comped_cents": 123,
"spend_cents": 123,
"entries": 123,
"billing_exempt": true,
"unattributed": {
"calls": 123,
"charged_cents": 123,
"comped_cents": 123,
"spend_cents": 123
},
"by_kind": [
{
"kind": "<string>",
"calls": 123,
"quantity": 123,
"charged_cents": 123,
"comped_cents": 123,
"spend_cents": 123
}
],
"by_model": [
{
"kind": "<string>",
"calls": 123,
"quantity": 123,
"charged_cents": 123,
"comped_cents": 123,
"spend_cents": 123,
"model": "<string>"
}
],
"by_api_key": [
{
"api_key_id": 123,
"name": "<string>",
"key_prefix": "<string>",
"is_active": true,
"calls": 123,
"charged_cents": 123,
"comped_cents": 123,
"spend_cents": 123,
"last_four": "<string>",
"last_used_at": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
BearerAuthApiKeyHeader
An EESI API key (sk-eesi-...) or a Clerk session token.
Query Parameters
Window length in days
Required range:
1 <= x <= 365Response
Successful Response
Work with no API key behind it — the console, and history predating key attribution. Reported so the key rows always sum to the total.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes