Query daily Antigravity token usage, cache hit rate & model cost breakdown (`/token-usage`, or when asked how many tokens were spent today / past N days / by model).
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Token Usage?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/xzha0637-design-token-usage)
---
name: token-usage
description: Query daily Antigravity token usage, cache hit rate & model cost breakdown (`/token-usage`, or when asked how many tokens were spent today / past N days / by model).
---
# Antigravity Token Usage Tracker
This skill queries local Antigravity transcript logs (`~/.gemini/*/brain/*/.system_generated/logs/transcript.jsonl`) in read-only mode to compute exact daily token consumption broken down by model, in the user's local timezone.
## Instant Zero-LLM Mode vs. Interactive Inline Card
- **Instant Zero-LLM Mode (`/token-usage`, `/token-usage 7d`, `/token-usage yesterday`, `/token-usage 30d`, `/token-usage YYYY-MM-DD`, with optional `zh|en`)**: Handled automatically by `hooks.json` (`PreInvocation`) in ~50 ms with **0 LLM calls and 0 thinking** — returns today's or the requested range's exact per-model breakdown right inside Chat.
- **Interactive Inline Card (`/token-usage card`, `/token-usage ui`, or natural-language questions)**: When the `token-tracker_dashboard` MCP server is available in the Antigravity App:
- Call **`show_token_summary`** (with optional `{ range: "today" | "yesterday" | "7d" | "30d" | "all", date: "YYYY-MM-DD", model: "..." }`) to render an **interactive mini summary card** (bar chart, model shares, and range switcher) directly inline in chat, while returning the exact Markdown numbers for your concise summary.
- To open the full interactive dashboard beside the conversation, call **`open_token_tracker`** (or let the user click **Plugins → Token Tracker** in the left sidebar or **Overview → Plugins** in the side panel).
## CLI Fallback & Advanced Queries
For non-UI environments (Antigravity CLI), daily digests, top conversations, or CSV export, run the bundled zero-dependency Node.js script (backed by persistent incremental caching):
```bash
# Today's usage by model
node ~/.gemini/config/plugins/token-tracker/scripts/token_stats.mjs --today
# Yesterday's usage by model
node ~/.gemini/config/plugins/token-tracker/scripts/token_stats.mjs --yesterday
# Yesterday's daily digest (with day-over-day comparison & top 5 sessions)
node ~/.gemini/config/plugins/token-tracker/scripts/token_stats.mjs --daily-digest
# Last 7 days (daily x model breakdown)
node ~/.gemini/config/plugins/token-tracker/scripts/token_stats.mjs --days 7
# Specific date (YYYY-MM-DD in local timezone)
node ~/.gemini/config/plugins/token-tracker/scripts/token_stats.mjs --date 2026-11-20
# All history, filtered to a specific model
node ~/.gemini/config/plugins/token-tracker/scripts/token_stats.mjs --all --model neon
# Structured JSON (includes hourly breakdown, workspace attribution, and top conversation trees)
node ~/.gemini/config/plugins/token-tracker/scripts/token_stats.mjs --days 7 --json
# Export CSV
node ~/.gemini/config/plugins/token-tracker/scripts/token_stats.mjs --all --csv
```
## Metric Definitions
- **Total Tokens**: `input_tokens + cache_read_tokens + output_tokens`
- **Fresh (Non-Cache) Tokens**: `input_tokens + output_tokens` (new prompt tokens + generated output tokens, excluding prompt cache reads)
- **Uncached Input (`input_tokens`)**: New prompt tokens not served from prompt cache
- **Cache Read (`cache_read_tokens`)**: Prompt tokens served from cache; **Cache Hit Rate** = `cache_read_tokens / (input_tokens + cache_read_tokens)`
- **Output (`output_tokens`)**: Model-generated completion and thinking tokens
- **Equivalent API Value**: Estimated USD value based on public per-1M-token rates, customizable via `${PLUGIN_DATA}/pricing.json` or the dashboard's **定价** dialog.
- **Model Attribution**: Uses each `PLANNER_RESPONSE` step's exact `model` field; for `CHECKPOINT` or legacy steps lacking `model`, resolves the active model from the conversation's `USER_SETTINGS_CHANGE` history. Subagent transcripts are included without double-counting.
## Presenting Results
1. When `show_token_summary` already rendered the interactive inline card, keep your text reply concise (highlight key takeaways without duplicating massive tables unless requested).
2. In CLI/plain-text mode, highlight **Total Tokens**, **Fresh (Non-Cache) Tokens**, **Cache Hit Rate**, and **Output Tokens**, and include the **per-model breakdown table** (both human-readable name and raw model ID).
3. If the user asks about top-consuming conversations or hourly trends, run with `--json` and summarize `topConversationTrees` / `topConversations` or `hourly`.
4. Remind the user they can open the full interactive dashboard anytime from Antigravity's left sidebar (**Plugins → Token Tracker**) or side panel (**Overview → Plugins → Token Tracker**).