usage-based-billing

usage-based-billing is a skill for Claude Code, Codex from dodopayments/dodo-agent-plugin. It costs 39 tokens per session (3,990 once invoked), scanned B, a copy of usage-based-billing, MIT.

A guide to charging customers according to how much they use a service, such as API calls, storage, bandwidth, or AI tokens. It explains how to record usage events, combine them into billable amounts, and apply them to subscriptions or purchases.

In plain words
What is it for?
Use it when building metered billing for an AI service, SaaS product, API, or infrastructure service, including free allowances and usage-based subscriptions.
Why use it?
It helps replace manual or ad-hoc usage calculations with a defined process for measuring and billing consumption.

Skill for Claude CodeCodex

Part of the dodopayments plugin — 17 skills, 2 MCP servers shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/dodopayments/dodo-agent-plugin/usage-based-billing
Any agent
npx skills add dodopayments/dodo-agent-plugin --skill usage-based-billing
Clone the repo
git clone --depth 1 https://github.com/dodopayments/dodo-agent-plugin

Made for: Claude Code, Codex.

Or install dodopayments, the plugin that ships this one along with the rest of its 17 skills, 2 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for usage-based-billing

README.md
[![agentmods](https://agentmods.dev/badge/skills/dodopayments/dodo-agent-plugin/usage-based-billing.svg)](https://agentmods.dev/skills/dodopayments/dodo-agent-plugin/usage-based-billing)
Your own site
<a href="https://agentmods.dev/skills/dodopayments/dodo-agent-plugin/usage-based-billing"><img src="https://agentmods.dev/badge/skills/dodopayments/dodo-agent-plugin/usage-based-billing.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,990 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00039 $0.03990
Opus 5 $0.00019 $0.01995
Sonnet 5 $0.00008 $0.00798
Haiku 4.5 $0.00004 $0.00399

Measured 3d ago against content hash f56ebab3138f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

usage-based-billing scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

await fetch('https://test.dodopayments.com/events/ingest', { method: 'POST',
Origin

This is a copy

100% identical to usage-based-billing — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/dodopayments/skills/usage-based-billing/SKILL.md · 541 lines

How it starts

The opening of the file, as written. The whole thing — 541 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Dodo Payments Usage-Based Billing

Reference: docs.dodopayments.com/features/usage-based-billing

Charge customers for what they actually use—API calls, storage, AI tokens, or any metric you define.


When to use this skill

  • You need to bill customers based on consumption (API calls, tokens, storage, bandwidth).
  • You want to combine usage charges with subscriptions or one-time purchases.
  • You need to track and aggregate events into billable quantities.
  • You're building an AI service, SaaS platform, or infrastructure product with metered features.

Core Concepts

Events

Usage records sent from your application to Dodo. Each event is attributed to a customer and matched to a meter by its event_name.

{
  "event_id": "evt_unique_123",
  "customer_id": "cus_abc123",
  "event_name": "api.call",
  "timestamp": "2025-01-21T10:30:00Z",
  "metadata": { "endpoint": "/v1/users", "tokens": 150 }
}

Meters

Filters and aggregates events into billable quantities. A meter specifies:

  • Event name: which events to match (case-sensitive)
  • Aggregation type: how to combine events (count, sum, max, last)
  • Measurement unit: the billing unit (calls, tokens, GB, etc.)
  • Optional filters: conditions events must meet to be counted

Aggregation Types

Type Use Case Example
Count Total events API calls, image generations
Sum Add values from a property Tokens used, bytes transferred
Max Highest value in a period Peak concurrent users
Last Most recent value Current storage used

For sum, max, and last, you specify which metadata property to aggregate.

Pricing

Attach a meter to a product price to charge per unit:

  • Price per unit: e.g., $0.001 per API call
  • Free threshold: e.g., 1,000 free calls per month
  • Charge formula: (usage − threshold) × price_per_unit

Read the full file on GitHub · 541 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 541 lines · 39 tokens per session scan B f56ebab3138f

Subscribe to this mod's changes

usage-based-billing is a skill published in the GitHub repository dodopayments/dodo-agent-plugin (6 stars, last pushed 10d ago), licensed MIT. It adds 39 tokens to every session and 3,990 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (sends data to an external url). It is 100% identical to usage-based-billing, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

deepen-plan

Stress-test an existing implementation plan and selectively strengthen weak sections with targeted research. Use when a plan needs more confidence around decisions, sequencing, system-wide impact, risks, or verification. Best for Standard or Deep plans, or high-risk topics such as auth, payments, migrations, external…

marcusrbrown/systematic · 76 tokens

reversi-master

One-click install + model switch:Claude Code,Codex CLI (OpenAI), Grok Build (xAI), DeepSeek Harness, Kimi Code (Moonshot) ,Qwen Code,Aider,OpenCode,MiMo Code (Xiaomi),ZCode (Z.AI),OpenClaw,Pi,OpenScience,Vibe-Trading,Claude Desktop (3P profile),ChatGPT desktop,OpenCode Desktop.

edison7009/EchoBird · 0 tokens

southwest

Search Southwest Airlines fares and points pricing via Patchright browser automation. SW is not in any GDS or API. Covers all fare classes, Companion Pass value, and fare drop monitoring.

borski/travel-hacking-toolkit · 40 tokens

chase-travel

Search Chase UR travel portal via Patchright for cash prices, points pricing, Points Boost offers, and Chase Edit hotel benefits. Use for pay-with-points portal comparison on Sapphire Reserve/Preferred.

borski/travel-hacking-toolkit · 44 tokens

compare-flights

Unified flight comparison across cash (Duffel, Ignav), award (seats.aero), and portal (Chase, Amex) sources in parallel. Outputs one table with transfer partner optimization and recommendations.

borski/travel-hacking-toolkit · 46 tokens

compare-hotels

Unified hotel comparison across Chase Edit, Amex FHR/THC, metasearch, and Airbnb. Highlights premium program benefits, stacking opportunities, and benefit-adjusted pricing.

borski/travel-hacking-toolkit · 40 tokens