Usage Events

Track customer usage for billing - real-time or batch

Basic Usage

Track user activity and bill for it. Common use cases:

  • Token usage - Measure API token consumption
  • Conversation count - Track chat/message volume
  • Payment tracking - Count transaction events

Seats use events too, but are handled differently. See the Seat Management section.

Send a single usage event:

const result = await commet.usage.create({
  eventType: 'api_call',
  customerId: 'cus_A1b2C3d4E5f6G7h8I9j0K1l2',
  quantity: 1,
})

console.log('Event tracked:', result.data.id)

Event Types

Create event types in the Commet dashboard first. This makes them available in our SDK for easier integration.

Learn more

Usage events library

How to integrate events with our SDK

Learn more →

How is this guide?