• Pricing
  • Blog
Log inBook a demo

Credit-Based Pricing: How to Implement It

Credit-based pricing gives customers credits that each action spends. How it works, and how to implement it with Commet: plan credits, credit packs, and what happens when credits run out.

Credit-based pricing is a pricing model where customers receive or buy credits, and each action in the product spends some of them. A subscription includes a credit allowance; when it runs out, the customer buys more credits or waits for the allowance to reset.

Unlike metered billing, credits give the customer a known ceiling: they see what they have left before they spend it, and nothing is billed after the fact unless you choose to allow it.

How credit-based pricing works#

A credits plan has three parts:

  • A base price that includes a credit allowance, for example $49/month with 500 credits.

  • A credit cost per action, for example 10 credits per document generation and 2 per text completion.

  • A way to buy more: fixed credit packs (200 credits for $19), any quantity at a price per credit, or an automatic top-up.

On day 18 a customer has used 480 of their 500 credits: two more documents before they run out. At that point they buy a pack or wait until the next reset brings the allowance back to 500.

Plan credits vs. purchased credits#

Plan credits come with the subscription and reset on a fixed cadence: every 7 days on weekly plans and every month on all other plans, yearly ones included. Unused plan credits expire at the reset unless the plan rolls them over, optionally up to a cap.

Purchased credits come from credit packs, a chosen quantity, or an automatic top-up. They never expire and carry over every reset until they are spent.

Plan credits are always spent first. Purchased credits are only used once the plan allowance is gone, so customers never lose credits they paid for to a reset.

How to implement credit-based pricing with Commet#

1. Create a credits plan#

In the dashboard, create a plan with the Credits consumption model, set the credits included in each price, and set how many credits each feature costs per use. A plan uses exactly one consumption model, so metered and balance features cannot be mixed into it.

2. Check and track usage#

Track each action with the feature code. Commet multiplies the event value by the feature's credit cost and deducts it, plan credits first. When an action is expensive, check first:

typescript
import { Commet } from "@commet/node";

const commet = new Commet({ apiKey: process.env.COMMET_API_KEY! });

const check = await commet.usage.check({
  customerId: "user_123",
  featureCode: "document_generation",
  quantity: 1,
});

if (check.allowed) {
  await generateDocument();
  await commet.usage.track({
    customerId: "user_123",
    featureCode: "document_generation",
    value: 1,
  });
}

3. Sell more credits#

Create credit packs in the dashboard, or set a price per credit on the plan so customers can buy any whole quantity above a minimum. Both charge the saved payment method and add purchased credits:

typescript
await commet.subscriptions.purchaseCredits({
  id: "sub_xxx",
  creditPackId: "cpk_abc123",
});

await commet.subscriptions.purchaseCredits({
  id: "sub_xxx",
  quantity: 500,
});

With a price per credit, customers can also turn on an automatic top-up that buys credits when their balance falls to a threshold. Customers buy packs and manage top-ups themselves in the customer portal.

4. Decide what happens when credits run out#

By default, usage stops. An event that needs more credits than the customer has is rejected with 402 insufficient_credits and nothing is deducted, so your app can show a "buy credits" prompt instead of running the action.

A paid plan with a price per credit can allow overage instead: usage continues and the missing credits are billed at that price at the next renewal. Trials and free plans always stop. To pace spending, a plan can also cap the plan credits spent per day or per week; past the cap, events use purchased credits or are rejected with 402 plan_credit_limit_reached.

Credits vs. customer credits#

Product credits are units that usage spends. A customer credit is money: a USD 25 goodwill credit, for example, that reduces the customer's next recurring invoices before tax. Usage events never spend customer credits, and product credits never reduce an invoice.

Credit-based pricing vs. metered and balance billing#

Credits, metered, and balance billing are three distinct consumption models.

With metered billing and overage enabled, the customer is never blocked: usage above the included amount is invoiced at the end of the period, which is seamless but can surprise them. With balance billing, the plan's base price becomes a monetary balance and each use deducts its real cost, which is how token-based billing for AI models is usually priced. Credits sit in between: a predictable ceiling for the customer, and a clear moment to sell a pack or an upgrade when they run out.

Paying for credits up front is a form of prepaid billing: the customer pays before using, and the credits are spent down afterwards.

When to use credit-based pricing#

Credits work best when actions cost you different amounts but you want customers to think in simple whole units. An image generator can charge 1 credit for a standard image and 4 for a high-resolution one without exposing infrastructure costs. A design tool can charge 1 credit per export and 5 per render, with the credit as the single currency across the product.

Credits are a poor fit when the customer cannot control consumption. A monitoring tool that ingests every log automatically would run users out of credits they never chose to spend; metered billing suits that product better.

Related#

  • AI billing: how AI products charge with tokens, credits, balance, and seats

  • Token-based billing: charging AI usage per input and output token

  • Prepaid billing: customers pay before they use, and usage draws the balance down

  • Usage-based billing: overview of the three consumption models

  • Consumption models: configure credits, rollover, and spending limits on a plan

  • Credit packs: packs, quantities at a price per credit, and automatic top-ups

  • Customer credits: monetary credit applied to invoices

Frequently Asked Questions

Create a plan with the Credits consumption model, set the credits each price includes and the credits each feature costs per use, and track usage with the SDK. Then sell more credits with credit packs or a price per credit. Commet spends plan credits first, then purchased credits.

Plan credits reset every 7 days on weekly plans and every month on all other plans, yearly ones included. Unused plan credits expire at the reset unless the plan rolls them over, optionally up to a cap. Purchased credits never expire.

By default, usage stops: an event that needs more credits than the customer has is rejected with 402 insufficient_credits and nothing is deducted. The customer can buy credits or wait for the next reset. A paid plan with a price per credit can allow overage instead, billed at that price at the next renewal; trials and free plans always stop.

Yes. With a saved payment method, customers can buy a credit pack, any whole quantity at the plan's price per credit, or turn on an automatic top-up at a threshold, from your app through the API or in the customer portal.

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