Skip to main content

Usage Tracking

Track all AI requests, costs, and performance metrics through RegPilot’s AI Gateway analytics dashboard.

What’s Tracked

Requests

Total API calls and patterns

Tokens

Input and output token usage

Costs

AI provider spending

Latency

Response times and performance

Errors

Failed requests and reasons

Models

Usage by AI model

Real-Time Dashboard

View live metrics:
  • Requests per second: Current throughput
  • Active requests: In-flight API calls
  • Success rate: Percentage of successful requests
  • Average latency: Mean response time
  • Cost per hour: Current spending rate

Cost Tracking

Cost Breakdown

{
  "period": "2024-01-05",
  "total_cost": 127.45,
  "by_model": {
    "gpt-4-turbo": 89.30,
    "gpt-3.5-turbo": 28.15,
    "claude-3-opus": 10.00
  },
  "by_feature": {
    "customer_support": 67.20,
    "content_generation": 45.15,
    "data_analysis": 15.10
  }
}

Budget Alerts

Set spending limits:
await regpilot.usage.setBudget({
  amount: 1000,
  period: "monthly",
  alert_thresholds: [50, 75, 90, 100],
  actions: {
    at_90: "notify_admins",
    at_100: "disable_keys"
  }
});

Usage Analytics API

Access usage data programmatically:
// Get usage for date range
const usage = await regpilot.usage.get({
  startDate: '2024-01-01',
  endDate: '2024-01-31',
  groupBy: 'day'
});

// Get costs breakdown
const costs = await regpilot.usage.costs({
  currency: 'USD',
  groupBy: 'model'
});

// Get performance metrics
const performance = await regpilot.usage.performance({
  metric: 'latency',
  aggregation: 'p95'
});

Exporting Data

Export usage reports:
  • CSV
  • PDF
  • API
Download raw data for analysis

Next Steps