Commet
  • Pricing
Log InTry out
Templates

Credits Template

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

Live DemoSource
Credits Template

Next.js SaaS template for products that sell actions priced in credits — image, text, voice. Customers receive credits included with their plan and spend them at a different rate per action.

Two plans (Starter, Pro) with three features consuming different credit amounts. When credits run out, usage is blocked until the customer tops up with a credit pack.

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

Run commet create my-app -t credits to start from this template, or browse the source on GitHub.

Developers

  • Documentation
  • Templates
  • GitHub

Frameworks

  • Next.js
  • Remix
  • Nuxt
  • SvelteKit
  • Astro
  • Express
  • Hono
  • Django
  • FastAPI

Resources

  • Blog
  • Changelog
  • Pricing

AI

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

Learn

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

Compare

  • Stripe alternative
  • Orb alternative
  • Recurly alternative
  • Paddle alternative
  • Chargebee alternative
  • Lago alternative

Company

  • About
  • Open Source
  • Terms
  • Privacy

Countries

  • Mexico
  • Argentina
  • Colombia
  • Chile
  • Peru
  • Ecuador
  • Uruguay
  • Paraguay
  • Bolivia
  • Panama
  • El Salvador
  • Brazil
System statusXLinkedInGitHub