Agent skill · software engineering · erichowens

cost-accrual-tracker

Track real-time API cost accrual during LLM execution. Activate on 'cost tracking', 'token usage', 'API costs', 'budget monitoring', 'usage metrics'. NOT for cost estimation, pricing tiers,

Why this skill is useful

Adds executable scripts for real-time cost tracking and budget management that aren't in public docs.

What it needs

About 4k tokens when loaded. Last updated 2026-07-14. 180 stars on the source repository.

What this skill does

Cost Accrual Tracker Real-time tracking of API costs during LLM execution with support for partial costs on abort. When to Use ✅ Use for: Implementing real-time cost tracking during execution Capturing partial costs when executions are aborted Building cost display widgets for execution UIs Integrating token counting into execution pipelines Adding budget thresholds with auto-stop ❌ NOT for: Cost estimation before execution (use pricing calculators) Billing system design (use billing-system skill) Price tier management or discounts Historical cost analytics dashboards Core Patterns 1. Token-Based Cost Calculation 2. Incremental Accrual Pattern Track costs as they accrue, not just at completion: 3. Abort-Aware Cost Capture Critical: Always capture partial costs on abort: 4. Budget Threshold Pattern Auto-stop execution when budget is exceeded: Anti-Patterns Lost Costs on Abort Novice thinking: "Just throw an error when aborted" Reality: If you don't capture costs before aborting, you lose: Token usage data for partial execution Accurate cost reporting for billing Audit trail for debugging Timeline: Always been an issue, but became critical with expensive models (GPT-4, Claude Opus) Correct approach: Always call finalize() with partial data BEFORE throwing abort errors. Polling Without Debounce Novice thinking: "Poll cost endpoint every 100ms for real-time updates" Reality: Wastes bandwidth and CPU Cost updates only happen after API responses Polling faster than response rate is pointless Correct approach: Poll at 1-2 second intervals, or use event-driven updates from the execution stream. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills erichowens/cost-accrual-tracker

View the source on GitHub

Browse the @skills marketplace