credit-metering

credit-metering is a skill for Claude Code, Codex from tushaarmehtaa/tushar-skills. It costs 42 tokens per session (759 once invoked), scanned A, original, MIT.

A skill for implementing or checking usage credits, where credits are consumable units an app spends on actions. It covers balances, reservations, spending, grants, purchases, expiry, refunds, limits, interface state, and an append-only transaction record.

In plain words
What is it for?
Use it when an app sells or grants credits, charges credits for actions, reserves them before work, refunds them, or needs an auditable history of changes.
Why use it?
It helps prevent incorrect balances, duplicate charges, overspending, and lost credit changes when usage is concurrent or retried.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when an app sells or grants credits, charges credits for actions, reserves them before work, refunds them, or needs an auditable history of changes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tushaarmehtaa/tushar-skills/credit-metering
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.

Any agent
npx skills add tushaarmehtaa/tushar-skills --skill credit-metering
Clone the repo
git clone --depth 1 https://github.com/tushaarmehtaa/tushar-skills

Made for: Claude Code, Codex.

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 credit-metering

README.md
[![agentmods](https://agentmods.dev/badge/skills/tushaarmehtaa/tushar-skills/credit-metering/github.svg)](https://agentmods.dev/skills/tushaarmehtaa/tushar-skills/credit-metering)
Your own site
<a href="https://agentmods.dev/skills/tushaarmehtaa/tushar-skills/credit-metering"><img src="https://agentmods.dev/badge/skills/tushaarmehtaa/tushar-skills/credit-metering/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for credit-metering

Your own site · 80×15
<a href="https://agentmods.dev/skills/tushaarmehtaa/tushar-skills/credit-metering"><img src="https://agentmods.dev/badge/skills/tushaarmehtaa/tushar-skills/credit-metering.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 759 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found 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.1 $0.00042 $0.00759
Opus 5.5 $0.00017 $0.00304
Sonnet 5.5 $0.00008 $0.00152
Haiku 4.5 $0.00004 $0.00076

Measured 2d ago against content hash d058976d659e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

credit-metering scanned grade A with 0 findings 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 2d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

credit-metering/SKILL.md · 36 lines

How it starts

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

Credit metering

Build credits as a financial state machine. Preserve existing denominations, billing semantics, and provider integrations.

Workflow

  1. Inspect backend/runtime, database/ORM, auth and tenant keys, current balance/ledger fields, payment provider, usage paths, retries, queues, and frontend state.
  2. Infer existing costs, grants, and packs from code. Ask only for unresolved commercial policy: denomination, per-action or measured cost, free/recurring grants, expiration/rollover, refund/clawback behavior, and overspend/debt policy. Never default to a new payment provider when one exists.
  3. Read database schemas, then implement only the matching database variant. Do not treat PostgreSQL, MySQL, Prisma providers, and MongoDB as interchangeable. PlanetScale runs both Vitess (MySQL) and Postgres: detect the engine before choosing. Write migrations that can run twice.
  4. Use an append-only ledger with a unique idempotency key/external event ID. Update cached balance and ledger in one database transaction, or derive balance from the ledger when scale permits. Enforce positive input amounts and the chosen non-negative/debt rule in the database.
  5. Implement explicit operations:
    • grant for signup, subscription, promotion, or admin credit;
    • reserve before costly/concurrent work;
    • capture after measured success;
    • release on cancellation/failure;
    • refund or reverse linked to the original transaction;
    • expire/rollover when credits have lifecycle rules.
  6. Authenticate and authorize from server context. Never accept balance, price, pack value, or user identity from the browser. Map a server-owned product/price ID to the credit amount.
  7. Read payment providers only for the detected provider, or for provider choice on a new build. Its facts carry a check date; re-check any older than 90 days before relying on it. On Lemon Squeezy, check its status and flag the Stripe Managed Payments migration path; do not start a new build on it by default. If the provider offers native credits (Dodo credit entitlements, Stripe credit grants), name one balance source of truth and keep gating usage in the app. Verify raw-body signatures, durably deduplicate events, and retry transient failures. Acknowledge before processing only after a durable queue/inbox write.
  8. Make promotions atomic. Use a redemption table with a unique (promo_id, user_id) constraint when one redemption per user is intended; update global usage and grant credit in the same transaction.
  9. Treat the UI balance as a projection. Reconcile after responses, account switches, multi-tab updates, refunds, and webhook grants. Optimistic display must not authorize work.

Read the full file on GitHub · 36 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago Changed d058976d659e
  2. 2mo ago First seen · 36 lines · 42 tokens per session scan A 26295bcbc73a

Subscribe to this mod's changes

credit-metering is a skill published in the GitHub repository tushaarmehtaa/tushar-skills (12 stars, last pushed 2d ago), licensed MIT. It adds 42 tokens to every session and 759 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

credit-metering compared with skills from other repositories

credit-metering next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
credit-meteringtushaarmehtaa/tushar-skillsSkill122d agoMITA42Claude Code, Codex
x402browser-use/browser-useSkill120ktodayMITA175Claude Code
tushareHKUDS/Vibe-TradingSkill38ktodayMITA79Claude Code, Codex
stripe-best-practicesstripe/aiSkill2.0ktodayMITA161Claude Code, Codex
wechatpay-payment-integrationwechatpay-apiv3/wechatpay-skillsSkill3725d agoMITA330Claude Code, Codex
hyperliquid-websocketgalleonlabs/hypergrok-trading-deskSkill3503d agoMITA89Claude Code
liter-llm-running-the-proxyxberg-io/liter-llmSkill264todayMITA45Claude Code