Docs / Overview
Build AI billing without token chaos
Install the SDK, meter AI events, sync Stripe top-ups, and ship a credit-first billing flow fast.
$ npm install @chargly/sdkStart here
Shortest path for new developers.
- 1
Install the SDK
npm install @chargly/sdk
- 2
Initialize Chargly
new Chargly({ apiKey })
- 3
Meter your first event
chargly.meterEvent({ customerId, event, credits })
Documentation index
Quickstart
GuideInstall, initialize, meter your first event.
Core Concepts
ConceptsCredits, wallets, usage events, top-ups.
Pricing Advisor
GuideDecide what AI actions should cost. Deterministic, explainable recommendations.
SDK Reference
ReferenceMethods, types, and examples.
Stripe Integration
IntegrationCheckout, webhooks, credit sync.
MCP Support
IntegrationAgent-native tools for balances, metering, top-ups.
Events & Metering
GuideDefine events, credit costs, and metering.
Webhooks
GuideTop-ups, deductions, balance updates.
Testing
GuideValidate your credit flow before going live.
Core concepts
Credits
Units users buy and spend on AI actions.
Wallets
Per-user balances updated in real time.
Usage Events
Billable AI actions like chat.reply or image.generate.
Pricing Rules
Credit costs per event. Versioned when Pricing Advisor recommendations are applied.
Top-ups
Stripe-powered purchases that add credits to wallets.
Quickstart preview
Minimal code sample. See full quickstart for details.
Install
$ npm install @chargly/sdkMeter event
await chargly.meterEvent({
customerId: "user_123",
event: "image.generate",
credits: 40
})