Connect model usage to the customer who generated it. AI-billing captures usage in Vercel AI SDK calls and sends normalized events to billing destinations such as Polar, Stripe, Lago, and OpenMeter.
Capture your first event
Use Node.js 22 or later. Install compatible packages in your Node.js project:
Set AI_GATEWAY_API_KEY in your server environment. Gateway inference can incur charges. Create billing.ts:
Run npx tsx billing.ts and inspect the console billing event for usage and cost. This meters a request; it does not charge a customer. Next, configure a billing destination and Customer Tagging from authenticated server state.
Learn more
Explore AI-billing and follow the quickstart for tagging and pricing sources. Choose a billing integration when you are ready to send customer-attributed events. Last modified on October 30, 2026