AI Gateway

Get gateway spend summary

Changed on

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

Request

  • Base URL: https://api.telnyx.com/v2
  • URL: https://api.telnyx.com/v2/llm_token_gateway/spend/summary
  • Auth: HTTP bearer

Query parameters

page[number]integer
page[size]integer
page[snapshot]string

Required after page 1; account/filter-bound 15-minute stable snapshot; expired/mismatch 409.

start_datestring date required
end_datestring date required
token_group_idstring uuid
token_user_idstring uuid
token_key_idstring uuid
end_user_idstring
metadataobject

Request tag filters as metadata[<key>]=<value>, 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.

'token_group' | 'token_user' | 'token_key' | 'end_user' required
OR
string required

Group by one request tag key. Keys starting with ltg_, telnyx_, litellm_ or cf_ (any case) are rejected.

A scope, or metadata:<key> to group by one request tag's text-form value; requests without the key form one group with a null dimension_id.

Response

OK

Changes