Use Case · Applications

Your users do more, you earn more. Usage-based billing for AI apps.

Per-seat pricing underprices power users and overcharges light ones. UsageTap lets you bill on real consumption—AI actions, workflow runs, generated outputs—so revenue scales with the value you deliver. Add a React hook or route handler and your entire billing pipeline is live.

Align price with value

Bill on AI actions, workflow runs, or generated outputs—not seat-count guesswork.

Protect gross margins

Entitlement gates and quotas prevent over-consumption before it erodes unit economics.

Unlock expansion revenue

Usage naturally grows with customer success. Pricing grows with it—no awkward upgrade conversations.

Three steps to usage-based billing

1

Add the React hook or route handler

useChatWithUsage gives your frontend streaming chat with built-in entitlement checks. streamOpenAIRoute wires up your Next.js API route in one call.

2

Define plans in the dashboard

Set quotas, rate limits, model access, and feature gates per tier. Adjust anytime without redeploying code.

3

Ship and scale

Usage flows to Stripe automatically. Customers see real-time consumption. Finance gets accurate invoices. Product gets pricing agility.

Full-stack billing in a few lines

useChatWithUsage gives your React frontend a streaming chat with built-in entitlement checks and usage reporting. streamOpenAIRoute wires up the server side in one function call. Or use withUsage for any backend action.

AIChatPanel.tsx
import { useChatWithUsage } from "@usagetap/sdk/react";

export default function AIChatPanel({ customerId }: { customerId: string }) {
  const {
    messages,
    input,
    setInput,
    handleSubmit,
    isLoading,
    stop,
    clear,
  } = useChatWithUsage({
    api: "/api/chat",           // your Next.js route
    customerId,
    feature: "ai-assistant",
    tags: ["app", "chat"],
  });

  // That's it. Every message automatically:
  //   ✓ Checks entitlements (premium model access, tool gating)
  //   ✓ Streams the response with real-time token counting
  //   ✓ Reports usage to UsageTap for billing
  //   ✓ Respects rate limits per customer tier

  return (
    <div className="flex h-full flex-col">
      <div className="flex-1 overflow-y-auto space-y-3 p-4">
        {messages.map((m) => (
          <div key={m.id} className={m.role === "user" ? "text-right" : ""}>
            <p className="inline-block rounded-lg bg-gray-100 px-3 py-2">
              {m.content}
            </p>
          </div>
        ))}
      </div>
      <form onSubmit={handleSubmit} className="flex gap-2 border-t p-4">
        <input
          value={input}
          onChange={(e) => setInput(e.target.value)}
          placeholder="Ask anything..."
          className="flex-1 rounded-lg border px-3 py-2"
          disabled={isLoading}
        />
        <button type="submit" disabled={isLoading}>Send</button>
      </form>
    </div>
  );
}

DIY billing stack

  • Custom usage-tracking tables, aggregation cron jobs, reconciliation scripts
  • Manual entitlement checks scattered across every feature endpoint
  • Stripe meter sync logic you built, maintain, and pray doesn't drift
  • Every pricing change requires a code deploy

With UsageTap

  • Usage metered automatically from SDK wrappers—no manual counting
  • Entitlements checked and enforced in every begin/end call
  • Stripe invoices and meters updated in real time, zero drift
  • Change plans, quotas, and pricing in the dashboard—no redeploy

Example application plan definitions

These map to customer-facing product outcomes, not raw infrastructure counters. Use them as launch templates, then tune entitlements by segment in the dashboard.

Free Tier

20 AI actions/mo · 5 exports/mo

Users can evaluate core features with hard limits. When allowances are hit, a contextual upgrade prompt drives conversion.

Best for: Self-serve PLG onboarding and fast activation.

Prepaid Credits

$250 → 50,000 workflow credits

Each workflow consumes credits by complexity. Teams buy predictable budget blocks and consume over a quarter without seat negotiations.

Best for: B2B buyers who need committed budget before production.

Pure PAYG

$0 platform fee · per-action billing

Bill per generated report, per automation run, or per AI action. Revenue is directly proportional to value delivered.

Best for: Usage that varies by season, campaign, or customer segment.

Hybrid: Prepaid + PAYG

$999 includes 100K actions + overage

Included usage covers baseline demand. Overage at a lower per-action rate rewards commitment while giving elastic headroom.

Best for: Scaling customers that want committed value and burst capacity.