Cost Management & Forecasting
Track API spending, forecast future costs, and optimize your budget with comprehensive cost management tools.
Overview
Cost Management helps you:
- Track costs per query, provider, and user
- Forecast spending for budget planning
- Set budgets and receive alerts
- Analyze trends to identify cost patterns
- Optimize spending with data-driven insights
Accessing Cost Management
Navigate to Cost Management:
Dashboard → Admin → Costs
URL: /dashboard/admin/costs
Note: Available to Admin and Editor roles only
Cost Dashboard
Overview Metrics
Top Cards Display:
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│ Total Spend │ │ This Month │ │ Avg per Query │
│ $24.67 │ │ $8.32 │ │ $0.0047 │
│ (All time) │ │ (Oct 2025) │ │ (5,245 queries) │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
┌─────────────────────────────────────────────┐
│ Budget Status │
│ $8.32 / $50.00 (16.6%) │
│ ████░░░░░░░░░░░░░░░░░░░░░░░░░ │
└─────────────────────────────────────────────┘
Metrics Explained:
- Total Spend: All-time API costs across all providers
- This Month: Current calendar month spend
- Avg per Query: Total spend ÷ total queries
- Budget Status: Current vs monthly limit with visual meter
Cost Trends Tab
View Daily/Weekly/Monthly Trends:
Daily Trend Example:
Daily Cost Trend - Last 30 Days
Cost (USD)
↑
1.50│ ●
│ ● ●
1.00│ ● ●
│ ● ●
0.50│ ● ●
│ ● ●
0.00└─────────────────────────────────→ Date
Oct 1 5 10 15 20 25 30
Trend Insights:
- Spending patterns by day of week
- Monthly growth rate
- Seasonal variations
- Anomaly detection (unusual spikes)
Provider Breakdown Tab
Cost by Provider:
Provider Cost Analysis
Claude (Anthropic)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries: 2,145
Cost: $6.43 (26.1% of total)
Avg: $0.003 per query
Trend: Stable ━
GPT-4 (OpenAI)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries: 1,892
Cost: $18.92 (76.7% of total)
Avg: $0.010 per query
Trend: Increasing ↗
Gemini (Google AI)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries: 856
Cost: $0.00 (Free tier)
Avg: $0.000 per query
Trend: Stable ━
Perplexity
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries: 352
Cost: $0.35 (1.4% of total)
Avg: $0.001 per query
Trend: Stable ━
Provider Insights:
- Which providers cost most
- Cost per query comparison
- Volume vs cost tradeoffs
- Trend direction (↗ ↘ ━)
User Cost Tab
Cost by Team Member:
User Cost Breakdown
john@example.com (Admin)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries: 3,245
Cost: $14.67
% of Total: 59.4%
sarah@example.com (Editor)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries: 1,456
Cost: $7.23
% of Total: 29.3%
mike@example.com (Analyst)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries: 544
Cost: $2.77
% of Total: 11.2%
Use Cases:
- Track team usage patterns
- Identify heavy users
- Allocate costs internally
- Plan per-user budgets
Cost Forecasting
Forecast Tab
Predictive Cost Analysis:
30-Day Cost Forecast
Method: Exponential Smoothing
Confidence: 85%
Current Spend: $8.32 (Oct 1-9)
Projected (Oct 31): $27.50 ± $4.20
Forecast:
$35 │ ●─── (Upper Bound)
│ ●───●
$30 │ ●───● ●─── (Forecast)
│ ●───●
$25 │ ●───● ●─── (Lower Bound)
│ ●───●
$20 │ ●───●
└─────────────────────────────────→ Date
Oct 9 15 20 25 30
Forecast Methods:
Linear Regression:
- Simple straight-line projection
- Good for steady growth
- Fast calculation
Exponential Smoothing:
- Accounts for recent trends
- Better for changing patterns
- More accurate for short-term
Moving Average:
- Smooths out fluctuations
- Good for stable patterns
- Less reactive to anomalies
Forecast Configuration
Adjust Forecast Parameters:
Lookback Period:
- 7 days: Recent trends (volatile)
- 14 days: Balanced (recommended)
- 30 days: Long-term patterns (stable)
- 90 days: Seasonal patterns
Forecast Horizon:
- 7 days: Short-term planning
- 30 days: Monthly budget (recommended)
- 90 days: Quarterly planning
Confidence Intervals:
- 68% (±1 σ): Narrow range
- 85% (±1.5 σ): Balanced (recommended)
- 95% (±2 σ): Wide range
Example Configuration:
Forecast Settings:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Method: Exponential Smoothing
Lookback: 14 days
Horizon: 30 days
Confidence: 85%
[Update Forecast]
Forecast Accuracy
Accuracy Metrics:
Forecast Performance
Mean Absolute Error (MAE): $1.23
Root Mean Square Error (RMSE): $1.89
Accuracy: 94.2%
Historical Forecasts vs Actual:
Forecast Actual Difference
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Sep 2025: $22.50 $23.10 +2.7%
Aug 2025: $18.30 $17.85 -2.5%
Jul 2025: $15.20 $16.10 +5.9%
Average Accuracy: 96.3% ✅
Improving Accuracy:
- Use longer lookback for stable usage
- Use exponential smoothing for changing patterns
- Review forecast weekly
- Adjust method if accuracy <90%
What-If Scenarios
Scenario Planning:
Scenario Analysis
Base Case (Current Usage)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries/day: 175
Projected (30d): $27.50
Scenario 1: Double Query Volume
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries/day: 350 (+100%)
Projected (30d): $55.00 (+100%)
Scenario 2: Use Only Free Tier (Gemini)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries/day: 175
Projected (30d): $0.00 (100% savings)
Scenario 3: Replace GPT-4 with Claude
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Queries/day: 175
Projected (30d): $12.40 (-55% cost)
Use Cases:
- Budget planning for growth
- Cost optimization analysis
- Provider switching decisions
- Campaign budget forecasting
Provider Cost Comparison
Cost Per Query
Comparative Analysis:
Cost per Query by Provider
Provider Cost/Query Est. 1000 Queries Quality Score
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GPT-4 $0.0100 $10.00 ⭐⭐⭐⭐⭐ (9.2/10)
Claude $0.0030 $3.00 ⭐⭐⭐⭐⭐ (9.0/10)
Perplexity $0.0010 $1.00 ⭐⭐⭐⭐ (7.8/10)
Gemini $0.0000 $0.00 ⭐⭐⭐ (6.5/10)
Quality Score Based On:
- Citation count per response
- Citation relevance
- Response depth
- Response accuracy
Cost Efficiency Ranking
Best Value Providers:
Rank 1: Perplexity
- $0.001 per query
- 5.0 avg citations
- Citations per dollar: 5,000
- Best for: High-volume testing
Rank 2: Claude
- $0.003 per query
- 6.3 avg citations
- Citations per dollar: 2,100
- Best for: Balanced quality/cost
Rank 3: GPT-4
- $0.010 per query
- 6.0 avg citations
- Citations per dollar: 600
- Best for: High-value analysis
Rank 4: Gemini
- $0.000 per query (free tier)
- 4.4 avg citations
- Citations per dollar: ∞ (free)
- Best for: Budget-conscious volume
Provider Switching Savings
Calculate Potential Savings:
Provider Switch Analysis
Current Mix:
- Claude: 40% of queries ($6.43)
- GPT-4: 35% of queries ($18.92)
- Gemini: 15% of queries ($0.00)
- Perplexity: 10% of queries ($0.35)
Total Current: $25.70/month
Optimized Mix (Same Quality):
- Claude: 60% of queries (+20%)
- Perplexity: 30% of queries (+20%)
- Gemini: 10% of queries (-5%)
- GPT-4: 0% of queries (-35%)
Total Optimized: $12.85/month
Savings: $12.85/month (50% reduction) ✅
Cost Optimization Recommendations
Automatic Insights
AI-Generated Recommendations:
Cost Optimization Opportunities
1. Replace GPT-4 with Claude for Standard Queries
Impact: -$12.50/month (48% savings)
Quality Impact: Minimal (0.2 citation difference)
Confidence: High (95%)
[Apply Recommendation]
2. Use Gemini for High-Volume Testing
Impact: -$3.20/month (12% savings)
Quality Impact: Moderate (lower citation rate)
Confidence: Medium (70%)
[Apply Recommendation]
3. Batch Similar Queries
Impact: -$1.80/month (7% savings)
Reduces duplicate queries
Confidence: High (90%)
[Apply Recommendation]
Total Potential Savings: $17.50/month (68%) ✅
Manual Optimization Strategies
Strategy 1: Provider Tiering
High-Value Queries (GPT-4 or Claude):
- Competitive analysis
- Client deliverables
- Strategic decisions
- Cost: $0.003-0.010/query
Standard Queries (Claude or Perplexity):
- Content research
- Regular monitoring
- Internal analysis
- Cost: $0.001-0.003/query
High-Volume Testing (Gemini or Perplexity):
- Query discovery
- Experimentation
- Trend testing
- Cost: $0.000-0.001/query
Strategy 2: Batch Processing
Before Optimization:
Execute 100 similar queries individually
Cost: $0.30 (Claude × 100)
After Optimization:
Batch 100 similar queries
- Detect duplicates: 15 queries
- Execute unique: 85 queries
Cost: $0.26 (15% savings)
Strategy 3: Caching Results
Coming Soon: Automatic result caching
Future Feature:
- Cache query results for 7 days
- Re-use for identical queries
- Savings: 20-40% for repeat queries
Budget Management Integration
View Budget Status
Budget Meter in Cost Dashboard:
Monthly Budget Status
$8.32 / $50.00
████░░░░░░░░░░░░░░░░░░ 16.6%
Days Remaining: 22
Avg Daily Spend: $0.92
Projected Month-End: $28.50
Status: ✅ On Track (57% budget remaining)
Status Indicators:
- ✅ On Track: <50% budget used, >50% month remaining
- ⚠️ Warning: >50% budget used, >50% month remaining
- 🔴 Over Budget: >100% budget used
Budget Alerts in Cost View
Alert Integration:
⚠️ Budget Alert
You've reached 80% of your monthly budget.
Current: $40.00 / $50.00
Projected Month-End: $52.50 (Over budget by $2.50)
Actions:
→ Review high-cost queries
→ Switch to lower-cost providers
→ Pause non-essential queries
→ Increase budget limit
[View Budget Settings]
Cost Tracking Details
Query-Level Costs
View Individual Query Costs:
Recent Queries - Cost View
Query Provider Cost Date
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
"best seo tools" GPT-4 $0.012 Oct 9
"content optimization tips" Claude $0.003 Oct 9
"project management software" Perplexity $0.001 Oct 8
"free cms platforms" Gemini $0.000 Oct 8
Sort by Cost:
- Identify most expensive queries
- Find cost optimization opportunities
- Budget allocation planning
Export Cost Data
CSV Export:
query_id,query_text,provider,cost_usd,executed_at,user_id
uuid-1,"best seo tools",gpt4,0.012,2025-10-09T10:23:00Z,user-1
uuid-2,"content tips",claude,0.003,2025-10-09T09:15:00Z,user-1
uuid-3,"pm software",perplexity,0.001,2025-10-08T14:30:00Z,user-2
Use Cases:
- Accounting reconciliation
- Internal cost allocation
- Tax reporting
- Custom analysis in Excel
Cost Analytics Best Practices
Regular Monitoring
Daily (for high-volume users):
- Check daily spend
- Monitor budget status
- Review any anomalies
Weekly (recommended):
- Review cost trends
- Check forecast accuracy
- Analyze provider mix
- Optimize based on insights
Monthly:
- Deep-dive analysis
- Budget vs actual review
- Provider performance comparison
- Strategy adjustment
Cost Control Strategies
Set Clear Budgets:
- Monthly organization budget
- Per-user limits (coming soon)
- Per-provider caps (coming soon)
Use Alerts:
- 50% budget threshold
- 80% budget threshold
- 100% budget (pause queries)
Optimize Provider Mix:
- Use GPT-4 sparingly (highest cost)
- Favor Claude for most queries
- Use Gemini for volume testing
- Leverage Perplexity for cost efficiency
Eliminate Waste:
- Remove duplicate queries
- Pause low-value queries
- Batch similar queries
- Cache results (coming soon)
Cost Attribution
By Project:
- Tag queries with project codes
- Track project-level costs
- Allocate budgets per project
- ROI calculation per project
By Department:
- User-based cost allocation
- Department budget tracking
- Chargeback reporting
By Campaign:
- Campaign-specific query sets
- Cost per campaign tracking
- Campaign ROI analysis
Advanced Cost Features
Cost Trends API (Coming Soon)
Programmatic Access:
GET /api/v1/costs/trends?period=30d
Response:
{
"total_cost": 24.67,
"period_cost": 8.32,
"daily_average": 0.92,
"forecast_30d": 27.50,
"trends": [
{"date": "2025-10-01", "cost": 0.45},
{"date": "2025-10-02", "cost": 1.23}
]
}
Custom Cost Reports (Phase 18)
Automated Reports:
- Weekly cost summary emails
- Monthly budget reports
- Cost forecasting reports
- Provider comparison reports
See: Scheduled Reports
Cost Optimization Automation (Coming Soon)
Auto-Optimization Features:
- Automatic provider selection (lowest cost)
- Query result caching
- Duplicate query detection
- Budget-based query queuing
Target Savings: 30-50% cost reduction
Troubleshooting
Cost Discrepancies
Problem: Dashboard cost ≠ Provider invoices
Common Causes:
-
Timing differences
- Dashboard: Execution timestamp
- Provider: Billing timestamp
- Solution: Compare monthly totals
-
Rounding
- Small rounding differences per query
- Normal: ±5% variance
- Solution: Accept minor differences
-
Estimation vs Actual
- Some costs are estimated
- Actual costs from provider API
- Solution: Wait for final billing
Forecast Inaccuracy
Problem: Forecast far from actual
Solutions:
- Increase lookback period (more data)
- Change forecast method (try exponential)
- Wait for more data (need 14+ days min)
- Check for anomalies in historical data
Missing Cost Data
Problem: Queries showing $0.00 cost
Causes:
- Gemini queries (free tier)
- Failed queries (not charged)
- Cost calculation error
Solutions:
- Verify query executed successfully
- Check provider response logs
- Re-execute if needed
- Contact support if persistent
Related Features
- Budget Management - Set limits and alerts
- Analytics - Query performance analysis
- Scheduled Reports - Automated cost reports
- Query Execution - Execute cost-conscious queries
FAQs
Q: How accurate is cost tracking? A: Within ±5% of actual provider costs. Variances due to rounding and timing.
Q: Can I set per-user budgets? A: Coming soon. Currently organization-level only.
Q: Which provider is most cost-effective? A: Perplexity for volume ($0.001/query), Claude for balanced quality/cost ($0.003/query).
Q: How often are forecasts updated? A: Real-time. Forecast updates as new queries execute.
Q: Can I export cost data for accounting? A: Yes. CSV export available with all transaction details.
Q: Do failed queries cost money? A: No. Only successful responses are charged.
Q: How can I reduce costs by 50%? A: Switch from GPT-4 to Claude, use Gemini for testing, eliminate duplicates.
Last Updated: October 9, 2025 Feature Status: Fully Implemented