cost-tracking
OfficialTrack and report Claude Code token usage, spending, and budgets from a local cost-tracking database. Use when the user asks about costs, spending, usage, tokens, budgets, or cost breakdowns by project, tool, session, or date.
What this skill does
When applied, it prepends a system prompt before your request is sent — no extra calls and no change to how you are billed beyond the added tokens.
--- name: cost-tracking description: Track and report Claude Code token usage, spending, and budgets from a local cost-tracking database. Use when the user asks about costs, spending, usage, tokens, budgets, or cost breakdowns by project, tool, session, or date. origin: community --- # Cost Tracking Use this skill to analyze Claude Code cost and usage history from a local SQLite database. It is intended for users who already have a cost-tracking hook or plugin writing usage rows to `~/.claude-cost-tracker/usage.db`. Source: salvaged from stale community PR #1304 by `MayurBhavsar`. ## When to Use - The user asks "how much have I spent?", "what did this session cost?", or "what is my token usage?" - The user mentions budgets, spending limits, overruns, or cost controls. - The user wants a cost breakdown by project, tool, session, model, or date. - The user wants to compare today against yesterday or inspect a recent trend. - The user asks for a CSV export of recent usage records. ## How It Works First verify prerequisites: ```bash command -v sqlite3 >/dev/null && echo "sqlite3 available" || echo "sqlite3 missing" test -f ~/.claude-cost-tracker/usage.db && echo "Database found" || echo "Database not found" ``` If the database is missing, do not fabricate usage data. Tell the user that cost tracking is not configured and suggest installing or enabling a trusted local cost-tracking hook/plugin. The expected `usage` table usually contains one row per tool call or model interaction. Column names vary by tracker, but the examples below assume: | Column | Meaning | | --- | --- | | `timestamp` | ISO timestamp for the usage event | | `project` | Project or repository name | | `tool_name` | Tool or event name | | `input_tokens` | Input token count, when recorded | | `output_tokens` | Output token count, when recorded | | `cost_usd` | Precomputed cost in USD | | `session_id` | Claude Code session identifier | | `model` | Model used for the event | Prefer `cost_usd`
Use this skill
Add a "skill" field with the skill’s ID to your chat completion request. It is applied server-side before your prompt is sent — no extra calls.
{
"model": "gpt-4o-mini",
"skill": "imp-0f79917f-aba4-4873-885b-3aa34236d543",
"messages": [{ "role": "user", "content": "…" }]
}Install the skill, enable it in your dashboard and (optionally) limit it to specific models. It then applies automatically to every matching request — with no "skill" field to send each time.
Set it up in your dashboardMore skills
Create, edit, audit, tidy, validate, or restructure AgentSkills and SKILL.md files.
Delegate coding work to Codex, Claude Code, or OpenCode as background workers; not simple edits or read-only code lookup.
Run, watch, debug, extend, or explain OpenClaw qa-lab and qa-channel scenarios, artifacts, and live lanes.
Search and analyze your own session logs (older/parent conversations) using jq.
Start voice calls via the OpenClaw voice-call plugin.
Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.
Diagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.