Token Tracker
Paste the following prompt into your AI chat to install this skill:
Please follow https://skillhub.cn/install/skillhub.md and install @user_4e3fb524/tokentracker into your AI assistant.
About this skill
Problem
Long-running LLM workloads create a practical accounting gap: developers need to know how much context remains in the current session, how many tokens were used in this conversation, what today or this week cost, whether a budget threshold was crossed, and how much balance a provider still has. These signals are often scattered across session state, billing APIs, and local logs, making cross-day or cross-model comparison awkward.
How it works
token tracker consolidates the query path into local scripts and JSON state files:
- Live session: reads session_status for token usage, cost, cache hit rate, and context occupancy;
- Historical usage: generates today's summary, detailed bill, weekly report, budget status, and budget updates;
- Data source: prefers configured provider APIs, merges usage into usage.json, and falls back to current-session recording when no provider is available;
- Automation: a session hook checks daily reports, weekly reports, and budget alerts at session start, with state files preventing duplicates; automation/ templates can be used for external scheduling.
It supports openai, anthropic, openrouter, deepseek, kimi, and minimax, including provider listing, usage fetch, and balance queries where available.
Boundaries
session_statusis only for the live session and should not be used fortoday's totalquestions;- some providers require Admin or Management API keys, and
deepseek,kimi, andminimaxare primarily balance-oriented; - zero usage is a valid result, but a corrupted
usage.jsonshould be surfaced as an error; - the response language follows the user, while script-backed outputs remain the primary source for engineers who want usage checks embedded in agent workflows.
Use Cases
- Inspect live session tokens, cache hit rate, and remaining context before compacting a long agent conversation.
- Generate today's summary, detailed bill, weekly report, and budget status during a recurring LLM cost review.
- Fetch provider usage and balance after connecting OpenRouter or DeepSeek, then verify local usage records.
- Check missed daily reports, weekly reports, and budget alerts when starting a new agent session.
Best For
- Engineers maintaining LLM workflows who need live session context, tokens, and cost checks.
- Technical owners responsible for API budgets who need daily or weekly usage, bills, and alerts.
- Platform engineers integrating model providers who need usage sync, balance queries, and local records.
- Agent ops authors who need automated daily reports, weekly reports, and budget reminders.
Related Skills
Generate Markdown public opinion reports by calling an internal service with MIDU_API_KEY.
Extracts Google AI Mode answers, standard SERP, AI Overviews, and citations via Pangolin APIs, with multi-turn follow-ups and region support.
Provides break-even analysis frameworks and templates without code execution, outputting structured recommendations.
Generate web reports from existing analysis data with classic or PPT-style layouts, Chart.js charts, and keyboard/touch navigation.