Skip to main content
Every metered feature has one code. Send that code as featureCode; Commet aggregates events for access, credits, balance, and billing.

Track an event

The request accepts: AI-model events use the same operation but send model, inputTokens, and outputTokens instead of value.

Business event ID vs request idempotency

eventId identifies the consumption event in your system. Reuse it when the same event is retried. Request idempotency protects one HTTP mutation and is passed through the SDK’s request options as idempotencyKey. It becomes the Idempotency-Key header. Do not put that transport key in the usage body.

Correct current-period usage

Use set when your source of truth needs to replace the current metered total:
value is the desired total, not a delta. Commet records a signed adjustment and preserves the original event trail. This operation applies only to the active metered period.

Check before consuming

When access or cost depends on the proposed quantity, call Usage Check before performing the action: