User Tools

Site Tools


api:ai:usage-breakdown

API : AI usage : Breakdown

Introduction

This request returns AI usage for a period grouped by a dimension: customer, reseller, service, model, context, voice or employee. JSON responses return the top N rows plus one aggregated rest row; CSV export returns all rows.

Scoping is identical to the summary endpoint. Grouping by customer or reseller requires minimum RESELLER.

Request

URL https://api.telecomx.dk/ai/usage/breakdown
Method GET
Access level MANAGER (scoped)
Query from Start of period, ISO date.
to End of period, ISO date.
by [optional] customer, reseller, service (default), model, context, voice or employee.
limit [optional] Top N rows for JSON responses, 1-1000, default 25.
format [optional] json (default) or csv. CSV is semicolon-separated, returned as attachment ai-usage.csv and contains all rows.
customer [optional] Only usage for this customer id.
reseller [optional] Only usage under this reseller id.
service [optional] TTS, STT or LLM.
context [optional] See the section page for values.

Query examples

https://api.telecomx.dk/ai/usage/breakdown?from=2026-08-01&to=2026-08-12&by=customer
https://api.telecomx.dk/ai/usage/breakdown?from=2026-08-01&to=2026-08-12&by=model&format=csv

Response

Rows are sorted by cost (ADMIN/RESELLER_ADMIN) or requests (everyone else), descending.

Property Type Description
rows Array Top N rows plus an optional rest row.
rows[].key String Id or value of the grouped dimension, null for records without it and for the rest row.
rows[].name String Display name (customer/employee name resolved, otherwise the raw value).
rows[].rest Boolean [optional] True on the aggregated rest row (everything beyond the top N).
rows[].requests Number Number of AI requests.
rows[].ttsCharacters Number TTS input characters.
rows[].ttsAudioMinutes Number Generated TTS audio minutes.
rows[].sttAudioMinutes Number Transcribed audio minutes.
rows[].inputTokens Number LLM input tokens.
rows[].outputTokens Number LLM output tokens.
rows[].failedPct Number (FAILED + TIMEOUT) / requests as percentage, 2 decimals.
rows[].costUSD Number [ADMIN/RESELLER_ADMIN only] Cost in USD, 4 decimals.
rows[].costDKK Number [ADMIN/RESELLER_ADMIN only] Cost in DKK, 2 decimals.

Errors

Error code Message Description
400 validation Invalid or missing query parameters
403 access_denied Insufficient access level, or by=customer/reseller requested below RESELLER
500 internal_error <Unspecified>
api/ai/usage-breakdown.txt · Last modified: by Per Møller

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki