Subscriptions, metering, entitlements, dunning — plus true unit cost per customer across your AI and infra stack. One SDK, no hard-coded billing logic. Stripe is just the rail underneath.
import nozle from '@nozle/sdk';
const nz = new nozle(process.env.NOZLE_KEY!);
// 1. Subscribe a customer to a plan
await nz.subscriptions.create({
customer_id: 'cus_acme',
plan_id: 'pro_monthly',
});
// 2. Meter what they use (AI, infra, anything)
await nz.events.track('gpt-4o', {
input_tokens: 3_240, output_tokens: 1_180,
customer_id: 'cus_acme',
});
// 3. Invoice + true unit cost — handled.
// → revenue $49.00 · cost $12.40 · margin 74.7%
Finance, product, and ops all read the same number. Subscriptions, usage, and cost write to the same timeline — append-only, so nothing is rewritten or lost.
// Meter any event
await nz.track('claude-sonnet-4', {
input_tokens: 3_240,
output_tokens: 1_180,
customer_id: 'cus_acme',
});
// Response — cost + margin inline
{
id: "evt_01HNX…q2",
cost_usd: 0.0428,
margin_usd:0.1572,
customer: "cus_acme",
received_at:"2026-04-26T14:02:11Z"
}
// → Cost & margin computed inline.
// ✓ typed · ✓ idempotent · ✓ replayable
Mix, match, or switch — without rewriting your billing code. Plus trials, coupons, grandfathering, multi-currency, minimum commits, averages, proration, dunning, and wallets.
Wire NozleOS into your stack and watch the first margin report land before your coffee gets cold.