usage-based-billing

Ingest usage events, aggregate meters, and map them to Dodo Payments products.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/irchamaji/agents --skill usage-based-billing-irchamaji
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: usage-based-billing
Source: https://github.com/irchamaji/agents/tree/main/skills/usage-based-billing
Command: npx skills add https://github.com/irchamaji/agents --skill usage-based-billing-irchamaji

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of manually guessing costs and billing customers incorrectly when your product value comes from variable usage like API calls or AI tokens.

Core Features & Use Cases

  • Usage events ingestion: Send metering events that describe what the customer did (for example, an API call or token consumption) with a unique event_id and customer_id.
  • Meter aggregation models: Convert raw events into billable quantities using Count, Sum, Max, or Last aggregations, including summing specific metadata properties such as tokens.
  • Metered products and pricing: Map meters to Usage-Based products with per-unit pricing and free thresholds, enabling accurate monthly billing and hybrid models with subscriptions.

Use case: Track AI token usage per completion (Sum over the tokens field), apply a free monthly threshold, and charge overage automatically, while also billing other activities like image generation or storage snapshots.

Quick Start

Send a usage event named api.call for each customer request, then create a Count meter on that exact event name and connect it to a Usage-Based product with your unit price and free threshold.

Frequently Asked Questions about usage-based-billing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I bill customers for AI token usage and API calls automatically?

You can automate usage billing by sending metering events with unique event IDs and customer IDs, aggregating them into billable meters, and linking those meters to per-unit priced products in Dodo Payments.

What is meter aggregation for usage billing and how does it work?

Meter aggregation converts raw customer usage events into billable quantities using Count, Sum, Max, or Last aggregation models, including summing specific metadata properties like AI tokens for accurate per-unit charging.

Can I combine usage-based metering with a flat subscription plan?

Yes, you can create hybrid billing models by mapping usage meters to Usage-Based products with per-unit pricing and free thresholds, while maintaining a standard metered subscription alongside it.

What data formats do I need to send for usage event ingestion?

Usage event ingestion requires uniquely identified events containing event_id, customer_id, event_name, timestamp, and metadata fields to successfully track and aggregate activities like API calls or token consumption.

How do I apply a free monthly threshold to AI token billing?

You apply a free threshold by mapping a Sum meter over the tokens metadata field to a Usage-Based product, configuring the free limit, and letting the system automatically charge for overage beyond the threshold.

Does usage-based billing work for tracking image generation and storage snapshots?

Yes, usage-based billing applies to image generation counting and storage snapshot billing by creating Count or Sum meters on specific event names and connecting them to Usage-Based products in Dodo Payments.