Skip to content

AI Detail Records (AIDRs) & Multimodal Margin Ledger

6 min readUpdated: Nov 29, 2026
View as Markdown
Role Primary Use Case Key Capabilities
Chief Financial Officer (CFO) Revenue analytics & financial reporting. Review recurring revenue (MRR/ARR), margin trends, and aggregate accounting ledgers.
Billing Operations Specialist Invoice generation & payment collections. Generate monthly billing runs, review unpaid balances, and reconcile gateway payouts.
Telecom Audit Specialist CDR & transaction reconciliation. Audit high-precision Call Detail Records (CDRs) and Message Detail Records (MDRs) against billing debits.

AI Detail Records (AIDR) Consumption

  1. Module Overview (Technical)
  2. Module Overview (Commercial & Business Value)
  3. Visual Interface & Ledger Structure
  4. Architectural Flow & Real-Time Rating Pipeline
  5. Common Scenarios & Operational Playbooks
  6. Glossary

The AI Detail Records (AIDRs) module serves as the financial ledger and real-time rating engine for all Artificial Intelligence services consumed across the platform. While traditional CDRs rate telephony minutes and MDRs rate SMS dispatches, AIDRs meter and rate multimodal AI workloads:

  1. AI Chat & AI Assistant Tokens: Prompt and completion tokens generated by the web portal AI Assistant, administrative assistants, and extension chatbots.
  2. Interactive Real-Time Voice Agents: Bidirectional conversational voice sessions conducted between callers and AI voice personas (e.g. OpenAI Realtime, ElevenLabs, Deepgram).
  3. Speech-to-Text (STT) Call Audio Transcription: Asynchronous post-call audio transcription and executive AI summary generation.

For every completed AI interaction, the rating engine evaluates two simultaneous financial dimensions:

  • Wholesale Vendor Cost (vendor_cost): The raw API consumption fee charged by the upstream AI provider (OpenAI, Anthropic, ElevenLabs, Deepgram).
  • Retail Customer Charge (billed_cost): The amount debited from the customer’s prepaid wallet or evaluated against bundled monthly plan quotas.
  • Gross Profit Margin (margin): Real-time net margin calculated as margin = billed_cost - vendor_cost, with gross margin percentage $\frac{\text{margin}}{\text{billed_cost}} \times 100$.

  • Multimodal AI Monetization: Enables telecom operators and ITSPs to offer AI chatbots, interactive voice agents, and automated call transcription with guaranteed profitability.
  • Atomic Plan Allowance Deductions: Seamlessly depletes customer subscription bundles (e.g., 500,000 monthly tokens, 100 voice minutes, 60 transcription minutes) before transparently falling back to pay-as-you-go wallet billing.
  • Negative Margin Prevention: Instant visibility into wholesale provider fees ensures operators price custom enterprise models with sustainable markups.
  • Full Audit Trail: Every AI session links to an exact call UUID, customer ID, model name, and token counter, preventing billing disputes.

The top toolbar renders dynamic metric KPI cards providing immediate visibility across the selected filter window:

  • Total AI Sessions: Aggregate count of rated AI chat, voice, and transcription events.
  • Gross Retail Billed: Total monetary spend charged to customers.
  • Net Margin Profit: Gross profit generated above wholesale provider costs.
  • Realtime Voice AI: Total interactive voice agent minutes delivered.
Column Data Field Description Example
Timestamp created_at Date and time the AI session was finalized and rated. 2026-09-22 14:32:05
AI Service & Model service_type + model_name Modality tag (chat, voice, stt) alongside provider and model. voice (openai:gpt-4o-realtime)
Session / Call ID session_uuid / call_uuid Unique platform session identifier and associated PBX call UUID. sess-8f3a91... / call-01a4...
Tokens Breakdown prompt_tokens / completion_tokens Granular breakdown of prompt input vs completion output tokens. In: 1,420 / Out: 840 (Total: 2,260)
Duration duration_seconds Elapsed interactive voice or audio transcription duration. 02m 45s (165 sec)
Billed Spend billed_cost Total charge assessed to the customer account. $0.4125 USD
Wholesale Cost vendor_cost Raw API expense assessed by upstream AI provider. $0.2750 USD
Gross Margin margin + margin_percent Net profit and margin percentage achieved on the transaction. +$0.1375 (+33.3%)
Billing Source billing_source Ledger source: bundle_deduction (Plan quota) or prepaid_wallet. bundle_deduction

PBX Call / Web Chat Event Completes
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ AIDR Rating Engine (aidrService) β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1. Parse token counters & audio duration β”‚
β”‚ 2. Identify active Customer Subscription: β”‚
β”‚ β€’ Check Service Type allowance balance β”‚
β”‚ 3. Evaluation: β”‚
β”‚ β”œβ”€ IF balance >= usage: β”‚
β”‚ β”‚ Deduct from subscription quota balance β”‚
β”‚ β”‚ Set billed_cost = $0.00 β”‚
β”‚ β”‚ Set billing_source = 'bundle_deduction'β”‚
β”‚ └─ IF balance < usage: β”‚
β”‚ Calculate overage at plan rate β”‚
β”‚ Debit customer prepaid wallet β”‚
β”‚ Set billing_source = 'prepaid_wallet' β”‚
β”‚ 4. Calculate vendor cost from AI Rate Card β”‚
β”‚ 5. Compute gross margin = billed - vendor β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Insert into ai_detail_records β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

A customer dials into an AI Receptionist powered by OpenAI Realtime voice:

  1. The call lasts 3 minutes 20 seconds (200 seconds).
  2. The customer’s plan includes 100 pooled voice minutes with 45 minutes remaining.
  3. The OCS rating engine deducts 3.33 minutes from subscriptions.ai_voice_minutes_balance.
  4. The transaction is recorded in AIDRs with billed_cost = $0.00, billing_source = bundle_deduction, and the wholesale vendor cost recorded for provider disbursement reconciliation.

Scenario B: Voicemail Speech-to-Text Transcription Overage

Section titled β€œScenario B: Voicemail Speech-to-Text Transcription Overage”

An enterprise customer with an exhausted transcription bundle receives a 90-second voicemail:

  1. Speech-to-text audio transcription is executed via Deepgram Nova-2.
  2. The customer subscription balance is 0 minutes.
  3. The plan overage rate of $0.0300/min is applied ($0.0450 total).
  4. $0.0450 is atomically debited from the customer’s prepaid balance, yielding an auditable AIDR with positive gross margin.

  • AIDR (AI Detail Record): A standardized, itemized financial record capturing token counts, session durations, wholesale vendor costs, and retail charges for an AI service.
  • OCS (Online Charging System): The real-time convergent rating engine that validates credit balances and deducts subscription quotas concurrently with active services.
  • Prompt Tokens: Text or multimodal inputs provided to the LLM context window.
  • Completion Tokens: Generated response tokens produced by the AI model.
  • Blended Minute: Combined input and output audio streaming rate assessed for real-time interactive voice agents.