Usage Analytics
Get usage analytics with the TypeScript SDK
Retrieve usage data and analytics.
Usage Summary
const summary = await client.usage.summary({
customerId: 'customer_123',
startDate: '2024-01-01',
endDate: '2024-01-31',
});Usage Breakdown
const breakdown = await client.usage.breakdown({
customerId: 'customer_123',
groupBy: ['model', 'provider'],
startDate: '2024-01-01',
endDate: '2024-01-31',
});Time Series
const timeseries = await client.usage.timeseries({
customerId: 'customer_123',
startDate: '2024-01-01',
endDate: '2024-01-31',
interval: 'day',
});Next Steps
- Error Handling - Handle errors
- Pagination - Handle paginated results