Get gateway spend summary
Return request counts, token counts and reference spend grouped by one attribution dimension. Both UTC dates and group_by are required. Dates use a half-open range [start_date, end_date) of at most 31 days. Cost reflects budget reference rates, not invoice charges. Unknown spend is excluded and reported separately. The report snapshot supports at most 10,000 matching requests, independently of page size. Exceeding this bound returns HTTP 503 without partial results. Narrow the date range or resource filters before retrying. A failed report must not be interpreted as zero usage. Request tags can filter either report and metadata:<key> can group the summary.
GET
/
llm_token_gateway
/
spend
/
summary
Get gateway spend summary
curl --request GET \
--url https://api.telnyx.com/v2/llm_token_gateway/spend/summary \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.telnyx.com/v2/llm_token_gateway/spend/summary"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.telnyx.com/v2/llm_token_gateway/spend/summary', 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.telnyx.com/v2/llm_token_gateway/spend/summary",
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.telnyx.com/v2/llm_token_gateway/spend/summary"
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.telnyx.com/v2/llm_token_gateway/spend/summary")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/llm_token_gateway/spend/summary")
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": [],
"meta": {
"page_number": 1,
"page_size": 20,
"has_more": false,
"snapshot": "9b7e4a10-3c2d-4f5e-8a6b-1d2c3e4f5a60",
"start_date": "2026-09-01",
"end_date": "2026-09-08",
"group_by": "token_group"
}
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "unauthorized",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "unauthorized",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "not_found",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "conflict",
"title": "Snapshot conflict",
"detail": "Correct the parameters to match a valid snapshot, or restart at page[number]=1 without page[snapshot].",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "precondition_failed",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "precondition_required",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "rate_limit_exceeded",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "enforcement_unavailable",
"title": "Request could not be completed",
"detail": "The report is unavailable or exceeds 10,000 matching requests. Narrow the date range or resource filters if the capacity limit is exceeded.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}Authorizations
Management-only Telnyx account credential.
Query Parameters
Required range:
x >= 1Required range:
1 <= x <= 100Required after page 1; account/filter-bound 15-minute stable snapshot; expired/mismatch 409.
Required string length:
1 - 256Pattern:
^[^\u0000-\u001f\u007f]+$Required string length:
1 - 256Pattern:
^[^\u0000-\u001f\u007f]+$Request tag filters as metadata[]=, at most 5, combined with AND. A value matches the tag's text form exactly (booleans as true/false, integers in decimal), so metadata[flag]=true matches both boolean true and the string "true". Keys are case-sensitive; reserved-prefix keys are rejected. Unindexed: bounded by the account, the date range and the report timeout.
Show child attributes
Show child attributes
A scope, or metadata: to group by one request tag's text-form value; requests without the key form one group with a null dimension_id.
Available options:
token_group, token_user, token_key, end_user Was this page helpful?
Get gateway spend summary
curl --request GET \
--url https://api.telnyx.com/v2/llm_token_gateway/spend/summary \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.telnyx.com/v2/llm_token_gateway/spend/summary"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.telnyx.com/v2/llm_token_gateway/spend/summary', 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.telnyx.com/v2/llm_token_gateway/spend/summary",
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.telnyx.com/v2/llm_token_gateway/spend/summary"
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.telnyx.com/v2/llm_token_gateway/spend/summary")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/llm_token_gateway/spend/summary")
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": [],
"meta": {
"page_number": 1,
"page_size": 20,
"has_more": false,
"snapshot": "9b7e4a10-3c2d-4f5e-8a6b-1d2c3e4f5a60",
"start_date": "2026-09-01",
"end_date": "2026-09-08",
"group_by": "token_group"
}
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "unauthorized",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "unauthorized",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "not_found",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "conflict",
"title": "Snapshot conflict",
"detail": "Correct the parameters to match a valid snapshot, or restart at page[number]=1 without page[snapshot].",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "precondition_failed",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "precondition_required",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "rate_limit_exceeded",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "enforcement_unavailable",
"title": "Request could not be completed",
"detail": "The report is unavailable or exceeds 10,000 matching requests. Narrow the date range or resource filters if the capacity limit is exceeded.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}{
"errors": [
{
"code": "invalid_request",
"title": "Request could not be completed",
"detail": "Check the request and the documented handling for this error.",
"meta": {
"request_id": "11111111-1111-4111-8111-111111111111"
}
}
]
}