Get gateway usage summary
Gateway reference/enforcement usage, not invoice truth or BYOK provider charges. Requires the dedicated llm_token_gateway.usage.read V2 action for combined spend and guardrail reporting; existing spend.read and guardrail_events.read grants do not grant this endpoint. All totals, UTC daily buckets, models and latest 20 guardrail events share one database snapshot. UTC half-open dates, at most 31 days. Zero-filled days; at most 1000 models (503 rather than truncation on overflow/timeout). Known tokens sum independently known categories across latest attempt evidence, including corrections; unknown spend is excluded and unknown_requests/reserved_spend remain explicit. Guardrail counts count events, not distinct requests. No raw spend events, prompts or secrets. This read-only report creates no pagination snapshot and accepts no pagination parameters.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.llmTokenGateway.usage.retrieveSummary();
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.llm_token_gateway.usage.retrieve_summary()
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.LlmTokenGateway.Usage.GetSummary(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.llmTokenGateway().usage().retrieveSummary();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.llm_token_gateway.usage.retrieve_summary
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->llmTokenGateway->usage->retrieveSummary();
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx llm-token-gateway:usage retrieve-summary \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/llm_token_gateway/usage/summary \
--header 'Authorization: Bearer <token>'{
"data": {
"totals": {
"requests": 2,
"input_tokens": 120,
"output_tokens": 30,
"unknown_requests": 1,
"cache_hits": 0,
"succeeded_requests": 1,
"failed_requests": 0,
"partial_requests": 0,
"spend": 0.00045,
"reserved_spend": 0.01
},
"by_day": [
{
"date": "2026-09-01",
"requests": 2,
"input_tokens": 120,
"output_tokens": 30,
"unknown_requests": 1,
"cache_hits": 0,
"succeeded_requests": 1,
"failed_requests": 0,
"partial_requests": 0,
"spend": 0.00045,
"reserved_spend": 0.01
}
],
"by_model": [
{
"model": "Qwen/Qwen3-235B-A22B",
"requests": 2,
"input_tokens": 120,
"output_tokens": 30,
"unknown_requests": 1,
"cache_hits": 0,
"succeeded_requests": 1,
"failed_requests": 0,
"partial_requests": 0,
"spend": 0.00045,
"reserved_spend": 0.01
}
],
"guardrails": {
"blocked_events": 0,
"flagged_events": 0,
"recent_events": []
}
},
"meta": {
"token_group_id": "11111111-1111-4111-8111-111111111111",
"start_date": "2026-09-01",
"end_date": "2026-09-02",
"metadata": {}
}
}{
"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": "idempotency_conflict",
"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_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 usage report could not be completed.",
"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
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
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.llmTokenGateway.usage.retrieveSummary();
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.llm_token_gateway.usage.retrieve_summary()
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.LlmTokenGateway.Usage.GetSummary(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.llmTokenGateway().usage().retrieveSummary();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.llm_token_gateway.usage.retrieve_summary
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->llmTokenGateway->usage->retrieveSummary();
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx llm-token-gateway:usage retrieve-summary \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/llm_token_gateway/usage/summary \
--header 'Authorization: Bearer <token>'{
"data": {
"totals": {
"requests": 2,
"input_tokens": 120,
"output_tokens": 30,
"unknown_requests": 1,
"cache_hits": 0,
"succeeded_requests": 1,
"failed_requests": 0,
"partial_requests": 0,
"spend": 0.00045,
"reserved_spend": 0.01
},
"by_day": [
{
"date": "2026-09-01",
"requests": 2,
"input_tokens": 120,
"output_tokens": 30,
"unknown_requests": 1,
"cache_hits": 0,
"succeeded_requests": 1,
"failed_requests": 0,
"partial_requests": 0,
"spend": 0.00045,
"reserved_spend": 0.01
}
],
"by_model": [
{
"model": "Qwen/Qwen3-235B-A22B",
"requests": 2,
"input_tokens": 120,
"output_tokens": 30,
"unknown_requests": 1,
"cache_hits": 0,
"succeeded_requests": 1,
"failed_requests": 0,
"partial_requests": 0,
"spend": 0.00045,
"reserved_spend": 0.01
}
],
"guardrails": {
"blocked_events": 0,
"flagged_events": 0,
"recent_events": []
}
},
"meta": {
"token_group_id": "11111111-1111-4111-8111-111111111111",
"start_date": "2026-09-01",
"end_date": "2026-09-02",
"metadata": {}
}
}{
"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": "idempotency_conflict",
"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_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 usage report could not be completed.",
"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"
}
}
]
}