Usage Analytics

Analyze usage data and trends

Get insights into your customers' usage patterns with detailed analytics.

Usage Summary

const summary = await client.usage.summary({
  customerId: 'customer_123',
  startDate: '2024-01-01',
  endDate: '2024-01-31',
});
summary = await client.usage.summary(
    customer_id="customer_123",
    start_date="2024-01-01",
    end_date="2024-01-31",
)

Usage Breakdown

Break down usage by different dimensions.

const breakdown = await client.usage.breakdown({
  customerId: 'customer_123',
  groupBy: ['model', 'provider'],
  startDate: '2024-01-01',
  endDate: '2024-01-31',
});
breakdown = await client.usage.breakdown(
    customer_id="customer_123",
    group_by=["model", "provider"],
    start_date="2024-01-01",
    end_date="2024-01-31",
)

Time Series Data

Get usage trends over time.

const timeseries = await client.usage.timeseries({
  customerId: 'customer_123',
  startDate: '2024-01-01',
  endDate: '2024-01-31',
  interval: 'day',
});
timeseries = await client.usage.timeseries(
    customer_id="customer_123",
    start_date="2024-01-01",
    end_date="2024-01-31",
    interval="day",
)

Next Steps

On this page