/install agent-usage-tracker
Agent Usage Tracker
Use this skill when you need local token accounting for AI agents.
What it provides
- Real-time token usage persistence in SQLite
- Cost calculation based on per-model pricing
- Budget thresholds with persisted warning and blocking states
- Usage statistics grouped by time window, session, or model
Files to use
src/UsageTracker.ts: ingestion, storage, and reportingsrc/CostCalculator.ts: pricing catalog and cost mathsrc/BudgetManager.ts: budget policy evaluationexamples/basic-usage.ts: end-to-end usage exampletests/: reference behavior for tracking, budgeting, and aggregation
Recommended workflow
- Instantiate
UsageTrackerwith a SQLite path or:memory:for tests. - Register model pricing with
CostCalculator. - Record each agent interaction with prompt tokens, completion tokens, session id, and timestamp.
- Save reusable budgets with
BudgetManager.setBudget, then callevaluateBudgetbefore or after new work to warn or stop when a limit is exceeded. - Use
UsageTracker.getUsageSummaryorgetTimeSeriesfor reporting.
Integration notes
- Store token counts at the moment the provider returns usage metadata.
- Keep model ids normalized. Pricing lookup is exact by model id.
- Use
metadatafor provider-specific fields such as request id or tool name. - For sliding-window budgets, query usage by
startTimeandendTimebefore dispatching new work.
Output expectations
This skill ships as a local Node.js package with tests and examples. Extend CostCalculator if your provider pricing changes.
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install agent-usage-tracker - After installation, invoke the skill by name or use
/agent-usage-tracker - Provide required inputs per the skill's parameter spec and get structured output
What is Agent Usage Tracker?
Track AI agent token usage, model costs, and budget thresholds with a TypeScript and SQLite workflow. Use when the user wants to instrument agent runs, calcu... It is an AI Agent Skill for Claude Code / OpenClaw, with 352 downloads so far.
How do I install Agent Usage Tracker?
Run "/install agent-usage-tracker" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Agent Usage Tracker free?
Yes, Agent Usage Tracker is completely free (open-source). You can download, install and use it at no cost.
Which platforms does Agent Usage Tracker support?
Agent Usage Tracker is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Agent Usage Tracker?
It is built and maintained by imgolye (@imgolye); the current version is v0.1.0.