cd /news/developer-tools/build-a-cdr-usage-analytics-dashboar… · home topics developer-tools article
[ARTICLE · art-53205] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Build a CDR Usage Analytics Dashboard in Python

Telnyx published a Python example that builds a CDR usage analytics dashboard using Flask and Telnyx AI Inference. The dashboard provides routes for metrics like summary, peak hours, and top routes, and uses AI to generate plain-English operational insights from the data. The code is available on GitHub and designed to be extended by developers or coding agents.

read1 min views1 publishedJul 9, 2026

Raw Call Detail Records are useful, but they are not exactly fun to read.

If you are building with voice, messaging, or any communications workflow, CDR-style data can answer practical questions:

I put together a small Python example that turns Telnyx CDR data into a Flask analytics API, then uses Telnyx AI Inference to generate a short operational readout.

Code: https://github.com/team-telnyx/telnyx-code-examples/tree/main/cdr-usage-analytics-dashboard-python

The example includes these routes:

GET /cdrs
GET /analytics/summary
GET /analytics/peak-hours
GET /analytics/top-routes
GET /analytics/daily
GET /analytics/ai-insights
GET /health

The analytics routes do the normal dashboard work in Python:

Then /analytics/ai-insights

takes a compact summary of the metrics and sends it to Telnyx AI Inference through the chat completions API.

Because the model should not be the calculator here.

For this kind of app, I like the split:

That way, your totals and costs stay deterministic, but your dashboard can still give users a helpful plain-English summary.

Clone the examples repo:

git clone https://github.com/team-telnyx/telnyx-code-examples.git
cd telnyx-code-examples/cdr-usage-analytics-dashboard-python

Create your .env

file:

cp .env.example .env

Add your Telnyx API key:

TELNYX_API_KEY=your_telnyx_api_key
AI_MODEL=moonshotai/Kimi-K2.6
HOST=127.0.0.1

Install and run:

pip install -r requirements.txt
python app.py

Test it:

curl http://localhost:5000/health

Get a summary:

curl "http://localhost:5000/analytics/summary?start_date=2026-07-01&end_date=2026-07-08" | python3 -m json.tool

Ask for AI insights:

curl http://localhost:5000/analytics/ai-insights | python3 -m json.tool

This is intentionally small, but the pattern is useful:

The repo is also agent-readable, so you can point a coding agent at the example and ask it to extend the dashboard, add charts, wire in auth, or adapt the metrics to your own workflow.

── more in #developer-tools 4 stories · sorted by recency
── more on @telnyx 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/build-a-cdr-usage-an…] indexed:0 read:1min 2026-07-09 ·