Commet
  • Pricing
Log InTry out
Templates

Balance Template

Balance-based billing with fixed unit prices. Customers prepay a balance and consume it per request at prices you set.

Live DemoSource
Balance Template

Balance-based billing template with fixed unit prices. Customers prepay a balance and usage deducts real dollars per action. Two plans (Starter, Pro) with different balances. Features have fixed per-unit costs (API calls, image processing).

Stack: Next.js 16, Better Auth, Drizzle ORM, PostgreSQL, Commet SDK

Quick Start

commet create my-app -t balance-fixed
cd my-app
pnpm install
pnpm dev

What's Included

  • Two plans with different starting balances ($25, $75)
  • Two features with fixed unit prices (API Call, Image Processing)
  • Balance deduction per usage at fixed rates
  • Block on exhaustion — usage stops when balance runs out
  • Interactive usage demo on dashboard
  • Customer billing portal with top-up support
  • Pricing page with balance amounts

Key Files

  • lib/auth/auth.ts — Better Auth + Commet plugin with usage module
  • lib/payments/commet.ts — Checkout session creation
  • app/(dashboard)/dashboard/page.tsx — Balance overview with usage simulation
  • app/pricing/page.tsx — Dynamic pricing page
  • app/api/commet/portal/route.ts — Customer portal redirect

Learn More

  • Consumption Models — Balance model details
  • Track Usage
  • Customer Portal

Developers

  • Documentation
  • Templates
  • GitHub

Resources

  • Blog
  • Changelog
  • Pricing

AI

  • Agents
  • MCP Server
  • Agent Skills
  • Claude Code
  • Codex

Learn

  • Guides
  • Glossary
  • Solutions
  • Billing for AI Models
  • Comparison

Company

  • About
  • Open Source
  • Terms
  • Privacy
XLinkedInGitHub