• Pricing
  • Blog
Log inBook a demo

Credits Template

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

Templates
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#

bash
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.

Subscription billing built for developers and agents

Get startedBook a demo

Accept global payments, handle usage-based pricing, subscriptions, and seats — without building your own infrastructure.

Frameworks

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

Resources

  • Documentation
  • Guides
  • Blog
  • Templates
  • Changelog
  • Glossary
  • Billing for AI models

Company

  • Solutions
  • About
  • Open Source

Compare

  • Stripe Billing
  • Orb
  • Chargebee
  • Lago
  • Autumn
  • Yuno

AI

  • Commet Agents
  • MCP Server
  • Skills
  • Skills on GitHub
  • Claude Code
  • Codex
  • Cursor
Follow us
© 2026 Commet Co.TermsPrivacy PolicyCookie Policy