token-cost-tracker

token-cost-tracker is a command for Claude Code from Mark393295827/third-brain-v7-skills. It costs 28 tokens per session (587 once invoked), scanned A, original, MIT.

A command for estimating, recording, and reporting how many AI model tokens a task uses and what they cost. It uses current billing rates supplied at runtime instead of storing fixed model prices.

In plain words
What is it for?
Estimate low, base, and high task costs, log actual usage in a CSV file, report spending, and mark the cost as unknown when current rates are unavailable.
Why use it?
It helps avoid outdated price calculations and makes cost estimates traceable by recording the rate source, timestamp, assumptions, and token totals.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Good fit Estimate low, base, and high task costs, log actual usage in a CSV file, report spending, and mark the cost as unknown when current rates are unavailable.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/mark393295827/third-brain-v7-skills/token-cost-tracker
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/Mark393295827/third-brain-v7-skills

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for token-cost-tracker

README.md
[![agentmods](https://agentmods.dev/badge/commands/mark393295827/third-brain-v7-skills/token-cost-tracker/github.svg)](https://agentmods.dev/commands/mark393295827/third-brain-v7-skills/token-cost-tracker)
Your own site
<a href="https://agentmods.dev/commands/mark393295827/third-brain-v7-skills/token-cost-tracker"><img src="https://agentmods.dev/badge/commands/mark393295827/third-brain-v7-skills/token-cost-tracker/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for token-cost-tracker

Your own site · 80×15
<a href="https://agentmods.dev/commands/mark393295827/third-brain-v7-skills/token-cost-tracker"><img src="https://agentmods.dev/badge/commands/mark393295827/third-brain-v7-skills/token-cost-tracker.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 587 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.00587
Opus 5 $0.00014 $0.00293
Sonnet 5 $0.00006 $0.00117
Haiku 4.5 $0.00003 $0.00059

Measured 10d ago against content hash d1c754726555, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

token-cost-tracker scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/token-cost-tracker.md · 74 lines

How it starts

The opening of the file, as written. The whole thing — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Token Cost Tracker

This is a utility command, not an Agent Skill. Pricing and model catalogs change; obtain rates from the current runtime/provider billing source and record its timestamp.

Inputs

task: ""
model_id: "runtime identifier"
capability_class: fast | reasoning | multimodal | evaluator | other
input_tokens: 0
cached_input_tokens: 0
output_tokens: 0
rates_per_million:
  input: null
  cached_input: null
  output: null
currency: ""
rate_source: ""
rate_checked_at: ""

If rates are unavailable, return token totals and cost_status: unknown; do not guess a price.

Estimate

Use measured source size, a comparable prior run, or an explicit low/base/high token range. Calculate each scenario:

cost = (input_tokens / 1,000,000 * input_rate)
     + (cached_input_tokens / 1,000,000 * cached_input_rate)
     + (output_tokens / 1,000,000 * output_rate)

Report assumptions, rate source/age, and the budget stop threshold. Do not infer token count from pages without labeling the conversion assumption.

Log

Append actual usage to .token-log.csv:

date,task,model_id,capability_class,input_tokens,cached_input_tokens,output_tokens,input_rate,cached_input_rate,output_rate,currency,cost,rate_source,notes
2026-07-11,wiki-ingest,runtime-model,reasoning,45231,12000,8732,0,0,0,USD,,provider-billing-page,rate unavailable at log time

Never rewrite historical rates. A later reconciliation appends a correction row referencing the original record.

Report

For the requested period return:

  • input, cached-input, output, and total tokens;
  • known cost by currency (never combine currencies silently);
  • unknown-cost rows requiring reconciliation;
  • breakdown by task, capability class, and model id;
  • estimate-versus-actual error when estimates exist;
  • largest cost driver and one bounded optimization test.

Failure Rules

  • Missing token counts: return NEEDS_INPUT.
  • Missing rates: compute usage only and mark cost unknown.
  • Stale rates: use only when the user accepts the dated estimate; otherwise refresh.
  • Mixed currencies: report separately or convert with an explicit dated exchange rate.
  • Log path not writable: return BLOCKED_PERMISSION; do not claim the row was saved.

Read the full file on GitHub · 74 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 74 lines · 28 tokens per session scan A d1c754726555

Subscribe to this mod's changes

token-cost-tracker is a command published in the GitHub repository Mark393295827/third-brain-v7-skills (138 stars, last pushed 19d ago), licensed MIT. It adds 28 tokens to every session and 587 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other commands, from other repositories

okf

A command that exports a private knowledge wiki into an OKF-compatible bundle. OKF is a format for packaging knowledge, with a separate guarded mode for preparing material to share externally.

kimsanguine/llm-brain · 14 tokens

ingest

A command for adding information to a file-based knowledge wiki from web pages, files, or text notes. It classifies the material, updates or creates wiki pages, and adds links between related pages.

kimsanguine/llm-brain · 19 tokens

pdf-to-wiki

A workflow for sending a large PDF from Google Drive to NotebookLM, Google's document-analysis tool, and saving the resulting notes as Obsidian markdown files. It passes the file link rather than reading the PDF directly.

capitalparser/notebooklm-wiki-pipeline · 0 tokens

openehr-explain

One-stop router that explains or looks up any openEHR thing — auto-detects an archetype, a template, an RM/AM/BASE type, an RM structural concept, an ADL idiom, an AQL query or keyword, or a terminology code (replaces /archetype-explain, /template-explain, /type-spec, /rm-structure, /adl-idiom, /terminology).

Cadasto/openehr-assistant-plugin · 95 tokens

sol

Run a one-shot task on the routed Codex model (gpt-5.6-sol by default) and relay its answer.

AiAi-Mastermind/aiai-mastermind-tools-and-skills · 26 tokens

verify

Verify a single Wiki page against 3 knowledge-integrity criteria — eligibility, consistency, confirmability. Writes verificationStatus back to the page; flags conflicts as disputed rather than deleting them.

johnfkoo951/cmds-llm-wiki · 37 tokens