API : AI usage

Logging and statistics for the platform's AI usage: ElevenLabs text to speech (TTS), ElevenLabs speech to text (STT) and Claude LLM summaries. Every AI request is logged with cost (USD and DKK) and reseller attribution frozen at write time.

Access scoping applies to all usage endpoints: Telecom X staff (ADMIN and RESELLER_ADMIN) see everything including cost; white label resellers (RESELLER) are locked to their own customer tree (sub-resellers included) and never receive cost fields; everyone else (minimum MANAGER) is locked to their own customer.

AI is also rationed and billed: a customer that may use AI has an AI product (Products, type AI) with a monthly included amount of transcription seconds, summary tokens and text-to-speech characters, and it names the models the customer's requests run on. Usage is counted per customer per month in AIUsageCounters, and a request is refused with 402 quota_exceeded when the customer has no AI product or has used up that resource. The quota endpoints below show the status, the history and sell top-ups.

API Description URL
Usage summary Stat totals for a period https://api.telecomx.dk/ai/usage/summary
Usage timeseries Chart data bucketed per day/week/month/year https://api.telecomx.dk/ai/usage/timeseries
Usage breakdown Grouped table by customer/reseller/service/model/context/voice/employee, incl. CSV export https://api.telecomx.dk/ai/usage/breakdown
Quota status This month's AI allowance, what is used and what is left https://api.telecomx.dk/ai/quota
Quota history AI usage month by month https://api.telecomx.dk/ai/quota/history
Top-up products The AI top-up products a customer may buy https://api.telecomx.dk/ai/quota/products
Buy top-up Buy an AI top-up for the current month https://api.telecomx.dk/ai/quota/topup/:product
Pricing list List AI model cost prices (ADMIN) https://api.telecomx.dk/ai/pricing
Pricing create/update Create or update a model price (ADMIN) https://api.telecomx.dk/ai/pricing
Pricing delete Delete a model price (ADMIN) https://api.telecomx.dk/ai/pricing/:id

The services are TTS, STT and LLM. The contexts (which platform feature triggered the request) are AUDIO_FILE, TTS_STREAM, STT_API, VOICEMAIL, RECORDING_TRANSCRIPTION, RECORDING_SUMMARY and UNKNOWN (legacy records migrated from the old TTSUsage collection).