Get Total Token Usage
curl --request GET \
--url https://api.example.com/api/total_token_usageimport requests
url = "https://api.example.com/api/total_token_usage"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/total_token_usage', 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.example.com/api/total_token_usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/total_token_usage"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/total_token_usage")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/total_token_usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"total_calls": 123,
"stt": {
"deepgram": {
"total_audio_seconds": 0,
"total_audio_tokens": 0
},
"sarvam": {
"total_audio_seconds": 0,
"total_audio_tokens": 0
}
},
"llm": {
"openai": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
},
"openrouter": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
}
},
"tts": {
"elevenlabs": {
"total_characters": 0,
"total_tts_tokens": 0
},
"sarvam": {
"total_characters": 0,
"total_tts_tokens": 0
}
}
}call_details
Get Total Token Usage
Get aggregated token usage across all calls by provider.
Returns total STT, LLM, and TTS token usage separated by provider:
- STT: Deepgram, Sarvam
- LLM: OpenAI, OpenRouter
- TTS: ElevenLabs, Sarvam
GET
/
api
/
total_token_usage
Get Total Token Usage
curl --request GET \
--url https://api.example.com/api/total_token_usageimport requests
url = "https://api.example.com/api/total_token_usage"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/total_token_usage', 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.example.com/api/total_token_usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/total_token_usage"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/total_token_usage")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/total_token_usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"total_calls": 123,
"stt": {
"deepgram": {
"total_audio_seconds": 0,
"total_audio_tokens": 0
},
"sarvam": {
"total_audio_seconds": 0,
"total_audio_tokens": 0
}
},
"llm": {
"openai": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
},
"openrouter": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
}
},
"tts": {
"elevenlabs": {
"total_characters": 0,
"total_tts_tokens": 0
},
"sarvam": {
"total_characters": 0,
"total_tts_tokens": 0
}
}
}⌘I