Agent skill · Backend & API

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, or billing systems.

majiayu000github.com/majiayu000GitHub ↗
claude-codecan modify filesMIT
Install
npx skills add majiayu000/claude-skill-registry --skill cost-accrual-tracker-curiositech-some-claude-skills --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 8 KB
Bundled scripts: none
Allowed tools: ReadWriteEdit
Path: skills/ai-llm/cost-accrual-tracker-curiositech-some-claude-skills/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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 ```typescript interface TokenUsage { inputTokens: number; outputTokens: number; cacheReadTokens?: number; // Prompt caching hits cacheWriteTokens?: number; // Prompt caching misses } interface CostCalculation { inputCostUsd: number; outputCostUsd: number; cacheSavingsUsd?: number; totalCostUsd: number; } function calculateCost(usage: TokenUsage, model: string): CostCalculation { const pricing = MODEL_PRICING[model]; const inputCostUsd = (usage.inputTokens / 1_000_000) * pricing.inputPerMTok; const outputCostUsd = (usage.outputTokens /

What's inside
Steps it walks through
  1. When to Use
  2. Core Patterns
  3. 1. Token-Based Cost Calculation
  4. 2. Incremental Accrual Pattern
  5. 3. Abort-Aware Cost Capture
  6. 4. Budget Threshold Pattern
  7. Anti-Patterns
  8. Lost Costs on Abort
  9. Polling Without Debounce
  10. Ignoring Prompt Caching
  11. Per-Request Cost Objects
  12. State Flow
  13. UI Display Pattern
  14. Integration Points
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the cost-accrual-tracker skill do?

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, or billing systems.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill cost-accrual-tracker-curiositech-some-claude-skills --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going