Commet
  • Pricing
Log InTry out
Templates

Credits Template

Credit-based consumption model with credit packs and top-ups. Perfect for AI products, generation tools, and multi-action platforms.

Live DemoSource
Credits Template

Credit-based billing template where customers receive credits with their plan and spend them on different actions. Two plans (Starter, Pro) with three features consuming different credit amounts. Blocked when credits run out, with credit pack top-ups.

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

Quick Start

commet create my-app -t credits
cd my-app
pnpm install
pnpm dev

What's Included

  • Two plans with included credits (500 and 2,500)
  • Three features with different credit costs (Image=10, Text=2, Voice=25)
  • Block on exhaustion — usage stops when credits run out
  • Credit pack purchases via customer portal
  • Credit balance overview on dashboard
  • Customer billing portal with top-up support
  • Pricing page with credit 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 — Credit balance and cost-per-action overview
  • app/pricing/page.tsx — Dynamic pricing with credit amounts
  • app/api/commet/portal/route.ts — Customer portal redirect

Learn More

  • Consumption Models — Credits model details
  • Credit Packs
  • 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