Preface¶
When running long sessions with OpenClaw or similar Agents, context and completions continuously consume tokens, and platform alerts often arrive late. To answer questions like “how much was spent today,” “what’s the trend this week,” or “how much budget remains,” you typically have to check the console or various billing pages, which is fragmented from the conversation context.
Below is an introduction to the community Skill token tracker (coordinates @user_4e3fb524/tokentracker, version 1.0.0). It collects current session data, daily/weekly statistics, budgets and alerts, as well as usage or balance interfaces from multiple service providers into a set of scripts and local data files within the Skill directory, which the Agent invokes according to the workflow in SKILL.md.
What This Is¶
token tracker is a token usage tracking Skill designed for the OpenClaw ecosystem, published by SkillHub user user_4e3fb524, categorized under data-analysis, and labeled as community source. The author’s SkillHub bio states that since they frequently encounter token alerts in personal use, they wanted to build usage reminders and evaluate daily spending.
Code repository: https://github.com/moubintju/token_tracker
SkillHub page: https://www.skillhub.cn/skills/user_4e3fb524/tokentracker
The Skill metadata is marked requires_api_key=true: if you want to use service provider billing/balance interfaces, you need to configure the corresponding API Key (type varies by vendor, see below).
Core Features¶
All the following capabilities come from the official SkillHub description and the SKILL.md in the repository.
Usage Queries¶
- Current session: View token count, cost, cache hit rate, context usage, etc. for this conversation via
session_status(only for “this” live session). - Today / specified date: Use the
summaryscript, supports--date YYYY-MM-DDto query historical dates. - Today’s details: Use the
billscript. - This week: Use the
weekscript.
Local aggregation and billing logic is executed by {baseDir}/scripts/token-tracker.js; persistent data is written to usage.json in the Skill directory (created automatically).
Budgets and Alerts¶
- Set budget: e.g., natural language “set budget 20” or
set budget 15, corresponding toset-budget --amount. - View budget status:
budget-status. - Supports automatic daily reports, weekly reports, budget reminders, and over-limit alerts; delivered at session start via
agent:bootstraphook, with state files includingreport-state.jsonandalert-state.json. The daily report trigger time can be configured inbudget.json’sdaily_report_hour(default 23).
Service Provider Integration¶
Official documentation supports integration with:
| Type | Service Providers |
|---|---|
| Usage/Billing APIs | OpenAI, Anthropic, OpenRouter |
| Balance Queries | DeepSeek, Kimi, MiniMax |
The SkillHub description states that most mainstream providers are covered, except for Google. The supported configure-provider --name values in SKILL.md are: openai, anthropic, openrouter, deepseek, kimi, minimax.
Integration details (consistent with official documentation):
- OpenAI: Requires Admin API Key, calls
/v1/organization/costs. - Anthropic: Requires Admin API Key (
sk-ant-admin-...), calls organization usage report interface. - OpenRouter: Requires Management API Key, pulls activity by day and model, and can query credits balance.
- DeepSeek / Kimi / MiniMax: Documentation indicates only balance-type queries are supported, no daily detailed usage API.
Configuration and data fetching command examples ({baseDir} is the absolute path after the Skill is installed):
node "{baseDir}/scripts/token-tracker.js" configure-provider --name openai --api-key <your-key>
node "{baseDir}/scripts/token-tracker.js" fetch-usage --lang zh
node "{baseDir}/scripts/token-tracker.js" provider-balance --name deepseek --lang zh
When the Agent Would Use This Skill¶
The description in SKILL.md lists typical intents, such as: “how many tokens were used today,” “detailed bill for today,” “weekly report,” “how much budget remains,” “configure OpenAI,” “fetch usage from API,” “query balance,” etc. When users ask questions in Chinese, it’s recommended to use --lang zh for the script side.
Installation and Activation¶
Install via SkillHub CLI¶
First check if skillhub is already installed on your machine (see the SkillHub installation documentation for installation methods). When installing the Skill, you must use --dir to point to the skills directory that the current Agent actually reads; otherwise, it may default to ./skills/ and not be loaded.
command -v skillhub && skillhub --version
skillhub install @user_4e3fb524/tokentracker --dir <your skills directory>
Common paths (from SkillHub installation documentation, select based on the client you actually use):
- OpenClaw and similar variants: The skills directory in each configuration (paths listed in NanoBot, PicoClaw, memUBot, etc. documentation).
- Cursor:
~/.cursor/skills/ - Claude Code:
~/.claude/skills/ - Codex:
~/.codex/skills/or.agents/skills/under the project
The SkillHub page also provides a prompt method for “let AI install @user_4e3fb524/tokentracker according to the installation documentation,” which essentially points to the same coordinates and skillhub.md.
One-time preparation within the session (Agent side)¶
According to SKILL.md, before processing usage-related requests at the start of each session, the Agent should:
- Check and install hooks if necessary (automatic daily/weekly reports/alerts):
node "{baseDir}/scripts/setup-hook.js" check
node "{baseDir}/scripts/setup-hook.js" install
- Before answering usage-related questions for the first time in this session, prioritize
list-providers; if there are already enabled providers with keys, silently executefetch-usage; otherwise, when no providers are configured, fall back tosession_status+record-session.
Related configuration files (all within the Skill directory, do not assume configuration exists outside the repository):
usage.json— usage databudget.json— budget anddaily_report_hourproviders.json— service providers and keys
Typical Usage¶
Assuming the Skill is installed and the Agent has loaded it, users can directly use natural language; the Agent invokes scripts according to SKILL.md. The following commands are convenient for manual verification or debugging (replace {baseDir} with the installation path).
Today’s summary:
node "{baseDir}/scripts/token-tracker.js" summary --lang zh
Today’s detailed bill:
node "{baseDir}/scripts/token-tracker.js" bill --lang zh
Weekly report:
node "{baseDir}/scripts/token-tracker.js" week --lang zh
Set budget to 15 (USD, as parsed by the script):
node "{baseDir}/scripts/token-tracker.js" set-budget --lang zh --amount 15
View configured providers:
node "{baseDir}/scripts/token-tracker.js" list-providers --lang zh
If the user only asks “how much was used in this conversation,” it should use session_status, not mistakenly treat “today” as the current session.
Use Cases and Notes¶
Who It’s For
- People who work long-term in OpenClaw or compatible Skill-convention environments and want to query token/cost information, weekly reports, and budgets through conversation.
- Users who already have accounts with organization/management keys for OpenAI, Anthropic, OpenRouter, etc., or need to monitor DeepSeek, Kimi, MiniMax balances.
Limitations and Notes
- The Skill describes itself as a self-contained directory implementation; data and configuration are all under
{baseDir}. Switching machines or clearing directories will lose local statistics, requiring re-runningfetch-usageorrecord-session. - “Detailed usage” for multiple vendors depends on Admin/Management keys; regular conversation keys may not be able to pull billing data. DeepSeek/Kimi/MiniMax are more balance-focused, and cannot be expected to be equivalent to OpenAI’s daily billing.
- Google does not appear in the official supported list; if Google models are your primary choice, you need to find alternative statistics methods.
- If hook installation fails, automatic daily/weekly reports/alerts may degrade to manual execution of templates under
automation/or self-scheduling. - The SkillHub page currently shows version v1.0.0; you can check SkillHub or GitHub for updates before installation.
Conclusion¶
token tracker combines session-level observability, local billing aggregation, budget alerts, and multi-service provider APIs into a data-analysis Skill, suitable for changing “token alerts” from after-the-fact checking to in-conversation queryable, budget-setting, and scheduled reminders. Experience and installation should be based on its SkillHub entry and GitHub repository: