• Pricing
  • Blog
Log inBook a demo
Introduction

Quickstart

Create an API KeyChoose a Billing Model

Learn

Resources

SDK ReferenceAPI VersioningError HandlingTestingCLIExamples

Plugins

Better Auth
System status
DocumentationKnowledge BaseBuild with AIAPI ReferenceWebhooks

Examples

Explore complete applications for the main Commet billing models and lifecycle patterns.

The examples are runnable applications, not isolated API snippets. Each one shows how product state, Commet configuration, server actions, and customer access work together.

Billing models

ExampleWhat it demonstrates
Fixed subscriptionA recurring plan, checkout, and subscription-backed access
Metered usageIncluded usage, event tracking, and overage
CreditsRecurring credits and credit-aware product actions
Fixed balancePrepaid monetary balance and top-ups
AI balanceAI token costs charged against a balance
SeatsTeam membership synchronized with seat quantities
QuotaCapacity checks and quota mutations

Lifecycle

The webhooks example shows subscription activation, past-due recovery, cancellation, signed event handling, and UI derived from confirmed billing state.

Run an example

Clone the repository, open one example directory, copy .env.example, and use a sandbox API key. Keep the example's database and Commet organization disposable; Test Clock operations and fixture cards are sandbox-only.

git clone https://github.com/commet-labs/commet.git
cd commet/examples/metered
cp .env.example .env
pnpm install
pnpm dev

Read the example together with the relevant conceptual guide. The source shows one implementation; How Billing Works defines the rules that remain true across frameworks.

How is this guide?

CLI

The official command-line tool for Commet. Manage billing, forward webhooks, and automate your workflow from the terminal.

Better Auth

Better Auth Plugin for Billing and Subscriptions using Commet

On this page

Billing models
Lifecycle
Run an example