Analytics
Deep dive into your AI spending patterns and optimization opportunities.
Analytics features are available on Pro and Enterprise tiers.
Overview
Analytics gives you advanced insights into:
- Spending trends and forecasts
- Model efficiency comparisons
- Customer profitability
- Feature cost analysis
- Optimization opportunities
Spending Trends
Time Series Analysis
View cost trends over:
- Hourly - Last 24 hours
- Daily - Last 7, 30, or 90 days
- Weekly - Last 12 weeks
- Monthly - Last 12 months
Chart features:
- Zoom and pan
- Compare time periods
- Overlay different metrics
- Export as PNG/CSV
Forecast
AI-powered spending forecast:
- Predicts next 30 days
- Based on historical patterns
- Accounts for trends and seasonality
- Confidence intervals shown
Example:
Current month: $450 (18 days elapsed)
Forecast: $750 ยฑ $50 (end of month)
Recommendation: On track for budgetAnomaly Detection
Automatically detects unusual patterns:
- Unexpected cost spikes
- Model switching
- Traffic patterns
- Error rate changes
Alert types:
- ๐ด Critical - Costs 3x normal
- ๐ก Warning - Costs 2x normal
- ๐ต Info - Unusual but not concerning
Model Performance
Cost per Model
Compare models by:
- Total cost
- Cost per 1,000 tokens
- Average latency
- Error rate
- Usage frequency
Example table:
| Model | Total Cost | Avg Latency | Error Rate | Usage |
|---|---|---|---|---|
| gpt-4 | $234.50 | 2,340ms | 0.5% | 12,450 |
| gpt-3.5 | $45.20 | 890ms | 0.2% | 89,230 |
| claude-3-opus | $123.40 | 1,450ms | 0.3% | 8,120 |
Model Recommendations
AI suggests model optimizations:
Example:
๐ก Optimization Opportunity
Feature: content-summarization
Current: gpt-4 ($234/month)
Suggested: claude-3-sonnet ($89/month)
Savings: $145/month (62% reduction)
Quality: Comparable (based on benchmarks)
Action: Run A/B test โToken Efficiency
Analyze token usage:
- Average tokens per request
- Prompt vs completion ratio
- Token waste detection
- Optimization suggestions
Token waste indicators:
- Long system prompts (repeated unnecessarily)
- Excessive context (entire docs when summary needed)
- Redundant API calls (caching opportunities)
Customer Analytics
Customer Profitability
See which customers are profitable:
Profitability score:
Revenue - (AI costs + other costs) = Profit
Profit / Revenue = Margin %Dashboard shows:
- Top 10 most profitable customers
- Top 10 least profitable customers
- Customer margin distribution
- Churn risk by profitability
Customer Segments
Segment customers by:
- Spending level (low/medium/high)
- Growth rate (growing/stable/declining)
- Model preference (GPT-4, Claude, mix)
- Feature usage (power users vs casual)
Use cases:
- Pricing tier placement
- Upsell opportunities
- Churn prevention
- Feature targeting
Cohort Analysis
Track customer cohorts over time:
- Signup month cohorts
- Spending evolution
- Retention by cost tier
- Lifetime value (LTV)
Feature Analytics
Feature Performance
Compare features by:
- Total cost
- Cost per user
- Usage frequency
- User satisfaction (if tracked)
Example:
| Feature | Cost | Users | Cost/User | Trend |
|---|---|---|---|---|
| Chat | $450 | 1,200 | $0.38 | โ 12% |
| Summarize | $234 | 800 | $0.29 | โ 5% |
| Translate | $89 | 450 | $0.20 | โ |
Feature ROI
Calculate ROI per feature:
Formula:
Revenue from feature - Cost of feature = Profit
Profit / Cost = ROI %Requires revenue attribution (manual input or integration).
Feature Optimization
AI suggests feature improvements:
Example:
๐ Feature Insight: email-summarization
Current usage:
- 450 calls/day
- $8.50/day cost
- gpt-4 model
Opportunity:
Switch to claude-3-haiku for emails <500 words
Estimated savings: $4.20/day ($126/month)
Quality impact: MinimalCost Optimization
Optimization Score
Overall score (0-100) based on:
- Model selection efficiency
- Token usage efficiency
- Caching opportunities
- Error rate
- Rate limit headroom
Example:
Your Optimization Score: 72/100
โ
Strengths:
- Low error rate (0.3%)
- Good model selection
โ ๏ธ Opportunities:
- High token waste (18%)
- No caching implemented
- Inefficient prompts detected
Potential savings: $234/monthCaching Opportunities
Identify repeated requests:
- Same prompts sent multiple times
- Similar prompts (can be cached)
- Static context (system prompts)
Savings calculator:
Repeated calls detected: 1,240/week
Current cost: $45/week
With caching: $12/week
Savings: $33/week ($143/month)Prompt Optimization
Analyze prompts for efficiency:
- Token count distribution
- Long prompts (>500 tokens)
- Repeated instructions
- Unnecessary context
Suggestions:
- Shorten system prompts
- Remove redundant context
- Use prompt templates
- Implement prompt compression
Reports
Automated Reports
Schedule reports:
- Daily - Cost summary, top models
- Weekly - Trends, anomalies, recommendations
- Monthly - Full analytics, forecasts, optimization
Delivery:
- Email (PDF attached)
- Slack (summary + link)
- Webhook (JSON data)
Custom Reports
Build custom reports:
- Choose metrics (cost, tokens, latency, etc.)
- Choose dimensions (model, customer, feature)
- Choose time range
- Add filters
- Schedule or download
Export formats:
- PDF (with charts)
- CSV (raw data)
- JSON (via API)
- Excel (Pro+)
Report Templates
Pre-built templates:
- Executive Summary - High-level overview for leadership
- Engineering Metrics - Latency, errors, performance
- Finance Report - Costs, forecasts, budgets
- Customer Report - Per-customer analytics
Integrations
Data Export
Export analytics data to:
- Google Sheets - Auto-sync daily/weekly
- Excel - Download or email
- Data warehouse - BigQuery, Snowflake (Enterprise)
- BI tools - Tableau, Looker, Power BI (Enterprise)
API Access
Programmatic access to analytics:
// Get cost analytics
const analytics = await fetch('https://api.aispendtrack.com/v1/analytics/costs', {
headers: {
'Authorization': 'Bearer your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
start_date: '2024-01-01',
end_date: '2024-01-31',
group_by: 'model'
})
});Best Practices
1. Review Weekly
Set aside time each week:
- Check spending trends
- Review top costs
- Implement one optimization
- Track savings
2. Set Baselines
Establish baselines for:
- Average daily cost
- Cost per customer
- Cost per feature
- Token efficiency
Track improvements over time.
3. A/B Test Optimizations
Before making changes:
- Implement change for 10% of traffic
- Monitor for 7 days
- Compare quality and cost
- Roll out if successful
4. Automate Reports
Set up automated reports:
- Daily summary for yourself
- Weekly report for team
- Monthly report for finance/leadership
5. Track ROI
Measure impact of optimizations:
- Cost before optimization
- Cost after optimization
- Savings per month
- Quality impact (if any)
Analytics Roadmap
Coming soon:
- ๐ Real-time analytics (sub-second updates)
- ๐ Custom dashboards
- ๐ Advanced forecasting (ML-based)
- ๐ Benchmark against similar companies
- ๐ Carbon footprint tracking
- ๐ Multi-account rollups (Enterprise)