token-cost

A command that displays token usage and estimated cost for the current project. Tokens are the small pieces of text an AI system processes.

In plain words
What is it for?
Use it to run a usage-and-cost report for the current project, with optional command arguments.
Why use it?
It lets you inspect project-level AI usage and estimated spending when you need a report.

Command

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.

agentmods
npx agentmods add commands/peiris/token-cost/token-cost
Clone the repo
git clone --depth 1 https://github.com/peiris/token-cost
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 326 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00009 $0.00326
Opus 5 $0.00005 $0.00163
Sonnet 5 $0.00002 $0.00065
Haiku 4.5 $0.00001 $0.00033

Measured 2d ago against content hash 230a21614782, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

token-cost 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 2d 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.md · 18 lines

What it actually says

!R="${CLAUDE_PLUGIN_ROOT}/scripts/report.py"; if [ -f "$R" ]; then python3 "$R" --cwd "$PWD" --budget 28000 $ARGUMENTS; else echo "token-cost: cannot locate report.py (CLAUDE_PLUGIN_ROOT=${CLAUDE_PLUGIN_ROOT:-unset}). Is the plugin installed?"; fi

The command's output is above. It is always there — it runs when this command is invoked, before you ever see this instruction.

Print that output exactly as it appears, inside a code block so any columns stay aligned. Copy it verbatim, character for character: do not re-align columns, re-wrap long lines, reformat it as markdown, shorten a label, round a number, or leave out rows. A task list can run to hundreds of rows and every one of them belongs in the output.

Sometimes the output is a table and sometimes it is a short message — for example, when the UI has been opened in its own window, or the full report in the browser. Print whichever one you got, the same way.

Add nothing of your own: no commentary, no summary, no interpretation. Never say the output is missing or that you did not receive it, never ask the user to paste it, and never offer to run the command yourself.

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. 2d ago First seen · 18 lines · 9 tokens per session scan A 230a21614782

Subscribe to this mod's changes

token-cost is a command published in the GitHub repository peiris/token-cost (2 stars, last pushed 5d ago), licensed MIT. It adds 9 tokens to every session and 326 once invoked, about $0.0000 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-31.