Measure before optimizing — estimate token counts locally with stated heuristics, price them at your model's rates, and quantify before/after savings, because token optimization without measurement…

MITAuto-check passedAI & LLM Engineering

Install Token Cost

skills CLI
$ npx skills add mohitagw15856/pm-claude-skills --skill token-cost -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mohitagw15856/pm-claude-skills token-cost --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mohitagw15856/pm-claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/token-cost .claude/skills/token-cost && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
token-cost
GitHub stars
1.4k
Token cost
~1.3k tokens
SKILL.md length
662 words
Files
2 (incl. scripts)
Skills in repo
1,348
Repo updated
First seen
Licence
MIT

At a glance

Measure before optimizing — estimate token counts locally with stated heuristics, price them at your model's rates, and quantify before/after savings, because token optimization without measurement…

  • Works in 5 steps: Volume is the multiplier that matters:… → Measure both sides of an optimization:… → Estimates are estimates, loudly: the… → …
  • Asked how many tokens is this
  • SKILL.md covers What This Skill Produces, Required Inputs, Programmatic Helper and Framework: The Measurement Rules, plus 4 more sections
  • Runs Python scripts from its folder; calls python3

What it does

Token Cost is an agent skill from mohitagw15856/pm-claude-skills. Measure before optimizing — estimate token counts locally with stated heuristics, price them at your model's rates, and quantify before/after savings, because token optimization without measurement is vibes. Use when asked how many tokens is this, what does this context cost per call, is this optimization worth it, or compare these two versions' cost. Produces the estimate with both heuristics shown, the cost math at your prices across your call volume, and the before/after comparison that decides whether an…

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including scripts (for example `scripts/token_cost.py`).

It sits in AI & LLM Engineering, covering LLM cost and token optimization. The repository describes itself as: 1255 professional Agent Skills for Claude, ChatGPT, Gemini, Cursor & Codex — PRDs, postmortems, leases, medical bills, layoffs, go-bags, new countries. Plain markdown, MIT, in… The licence is MIT.

When your agent uses it

  • Asked how many tokens is this
  • What does this context cost per call
  • Is this optimization worth it
  • Compare these two versions cost

Example prompts

  • “/token-cost”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Volume is the multiplier that matters: cost = tokens × price × calls — and calls is the term intuition drops. System prompts, standing…
  2. Measure both sides of an optimization: the crushed version's savings minus what the optimization itself costs (a crush header, an index…
  3. Estimates are estimates, loudly: the ±15% label is permanent; decisions that need exact counts (billing disputes, hard context limits)…
  4. Price the journey's stages separately: input tokens (usually cheap, high volume), output tokens (usually 3–5× the price — why output…
  5. The worth-it verdict is a sentence, not a spreadsheet: "saves $0.31 per hundred calls; the crush step is one pipe — worth it" or "saves 60…

What it can do on your machine

Read from SKILL.md and the folder at commit 1cbf1f0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Token Cost loads about 1.3k tokens when it runs. Until then it costs about 140 tokens; SKILL.md has 662 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~140
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from mohitagw15856/pm-claude-skills at commit 1cbf1f0, republished under its MIT licence (© mohitagw15856). 662 words, ~1,342 tokens.

Download SKILL.mdSave it as .claude/skills/token-cost/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
token-cost
description
Measure before optimizing — estimate token counts locally with stated heuristics, price them at your model's rates, and quantify before/after savings, because token optimization without measurement is vibes. Use when asked how many tokens is this, what does this context cost per call, is this optimization worth it, or compare these two versions' cost. Produces the estimate with both heuristics shown, the cost math at your prices across your call volume, and the before/after comparison that decides whether an optimization earned its complexity.

Token Cost Skill

Every token optimization should start and end with the same question: how many, at what price, how often? — and most skip all three. This skill is the measurement layer: local token estimates (two stated heuristics, averaged, no tokenizer dependencies), cost math at your model's prices (supplied, never baked in — prices change faster than repos), and the before/after comparison that turns "this feels smaller" into "saves 4,200 tokens, $1.26 per hundred calls." The honest core: a 40% saving on something sent once is a rounding error; 8% on something sent every call is real money — the --calls flag is the whole insight.

What This Skill Produces

  • The estimate — chars/4 and words×4/3, both shown, averaged, with the ±15% honesty label
  • The cost math — per call and across the stated call volume, at supplied prices
  • The comparison — before vs. after any optimization: tokens saved, percent, dollars at volume
  • The verdict frame — worth-it / not-worth-it, decided by volume × savings vs. the optimization's own complexity

Required Inputs

Ask for these if not provided:

  • The content — file or text to measure; for comparisons, both versions
  • The prices — the model's $/M input (and output if relevant) — from the user's provider page, today's, because baked-in prices are stale prices
  • The volume — how many calls this content rides along on (a system prompt rides every call; a one-shot report rides one) — the multiplier that decides everything

Programmatic Helper

bash
python3 scripts/token_cost.py --file context.md --price-in 3 --calls 200
python3 scripts/token_cost.py --file original.json --compare crushed.json --price-in 3 --calls 200

Deterministic, stdlib-only. Two heuristics (≈4 chars/token, ≈0.75 words/token) averaged and labeled as estimates — real tokenizers vary by model and content type, and the script says so on every run rather than cosplaying as one.

Framework: The Measurement Rules

  1. Volume is the multiplier that matters: cost = tokens × price × calls — and calls is the term intuition drops. System prompts, standing context, and per-turn tool schemas ride every call; optimizing them compounds. One-shot content barely matters however big it is. Every measurement states its volume assumption.
  2. Measure both sides of an optimization: the crushed version's savings minus what the optimization itself costs (a crush header, an index that must also be loaded, engineering time) — comparisons that only count the win are marketing.
  3. Estimates are estimates, loudly: the ±15% label is permanent; decisions that need exact counts (billing disputes, hard context limits) need the provider's tokenizer, and the skill says so instead of faking precision. For is-this-worth-it decisions, ±15% is plenty.
  4. Price the journey's stages separately: input tokens (usually cheap, high volume), output tokens (usually 3–5× the price — why output discipline like token-diet pays disproportionately), and cached-input rates where the provider offers them (stable prefixes can cost ~10% of fresh input — measurement should know which bucket content falls in).
  5. The worth-it verdict is a sentence, not a spreadsheet: "saves $0.31 per hundred calls; the crush step is one pipe — worth it" or "saves 60 tokens once; skip." Every measurement ends in one, because the point of measuring was deciding.
Show full SKILL.md (181 more words)Show less

Output Format

Token Cost: [content] — at $[X]/M × [N] calls

[Script output: both heuristics, the estimate, the cost lines]

[Comparison mode: the before/after with savings at volume]

The verdict: [worth-it / not-worth-it, in one sentence with the reasoning] Estimates ±15%; prices supplied by you, dated today; exact counts need the provider's tokenizer.

Quality Checks

  • Both heuristics shown, average labeled as an estimate
  • Prices came from the user, never from memory
  • The call-volume assumption is explicit in every cost figure
  • Comparisons subtract the optimization's own cost
  • The measurement ends in a worth-it sentence

Anti-Patterns

  • Do not recite model prices from memory — they change; ask for today's
  • Do not present heuristic counts as tokenizer truth — the ±15% label is load-bearing
  • Do not optimize unmeasured — "feels smaller" has shipped many complexity-positive savings
  • Do not ignore volume — the same 500 tokens is negligible once and structural at every-call
  • Do not end without the verdict — a measurement that doesn't decide anything measured nothing

Example Trigger Phrases

  • "How many tokens is this?"
  • "What does this context cost per call?"
  • "Is this optimization worth it?"
  • "Compare these two versions cost."

© mohitagw15856, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (scripts) in skills/token-cost of mohitagw15856/pm-claude-skills.

  • SKILL.md
  • scripts/token_cost.py

Open the folder on GitHubat commit 1cbf1f0

Compare with similar skills

Token Cost next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Token Cost compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Token Cost this skillmohitagw15856/pm-claude-skills1.4k—~1.3kAutomated safety check: PassMIT
Context Compressionguanyang/open-agent-hub9772 repos~4.6kAutomated safety check: PassMIT
Bounty Hunter1sadjlk/bounty-hunter-skill2821 repos~761Automated safety check: PassMIT
Skill Shortenerluongnv89/asm955—~3.8kAutomated safety check: NotesMIT
Context Auditundefined-ui/second-brain-os1k—~802Automated safety check: PassMIT
Headroommomori777/Artemis380—~562Automated safety check: PassMIT

Similar skills

  • Context Compression

    guanyang/open-agent-hub

    This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve…

    977 GitHub starsUsed in 2 repos~4.6k tokens
    AI & LLM EngineeringAuto-check passed
  • Bounty Hunter

    1sadjlk/bounty-hunter-skill

    A professional AI bounty hunter persona named Atlas. An agent skill from 1sadjlk/bounty-hunter-skill.

    282 GitHub starsUsed in 1 repo~761 tokens
    AI & LLM EngineeringAuto-check passed
  • Skill Shortener

    luongnv89/asm

    Refactor a too-long SKILL.md by progressive disclosure: measure token cost, classify every section KEEP/CUT/MOVE, shorten the body into references/ and scripts/, verify nothing was lost.

    955 GitHub stars~3.8k tokensUpdated today
    AI & LLM EngineeringAuto-check: notes
  • Context Audit

    undefined-ui/second-brain-os

    Audit an agent's context layout against the four places: system prompt, tools, history, tail.

    1k GitHub stars~802 tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Headroom

    momori777/Artemis

    SmartCrusher + CCR context compression — crunch large JSON arrays, tool outputs, and search results to save tokens.

    380 GitHub stars~562 tokensUpdated 10 days ago
    AI & LLM EngineeringAuto-check passed
  • AI

    butterbase-ai/butterbase-skills

    A skill your agent uses when calling the app's AI gateway from agent tools — chat completions, embeddings, listing models, configuring defaults or BYOK, reading token/cost usage

    534 GitHub stars~1.1k tokensUpdated 5 days ago
    AI & LLM EngineeringAuto-check passed

More from mohitagw15856/pm-claude-skills

All 1,348 skills in this repo
  • Car Tco

    mohitagw15856/pm-claude-skills

    Compare the total cost of car ownership across buy-new, buy-used, lease, and keep-your-current-car — depreciation, insurance, maintenance ramp, and fuel over a real horizon, not just the monthly…

    1.4k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Cs Health Scorecard

    mohitagw15856/pm-claude-skills

    Build a customer health scorecard for a specific account. An agent skill from mohitagw15856/pm-claude-skills.

    1.4k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed
  • Exit Waterfall

    mohitagw15856/pm-claude-skills

    Compute who gets what at each exit price from a cap table — liquidation preferences, conversion points, and where the founders' share collapses.

    1.4k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Feature Prioritisation

    mohitagw15856/pm-claude-skills

    Apply prioritisation frameworks (RICE, MoSCoW, Kano, ICE, Opportunity Scoring) to rank features and backlog items.

    1.4k GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Fire Number

    mohitagw15856/pm-claude-skills

    Compute a financial-independence (FIRE) target and years-to-reach with every assumption labeled as an assumption — plus a sensitivity table instead of a single false-precision answer.

    1.4k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Freelance Rate

    mohitagw15856/pm-claude-skills

    Derive a freelance day/hourly rate backwards from target income, honest billable utilization, overhead, and the self-employment tax premium — the arithmetic that proves a rate is not salary÷2000.

    1.4k GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed

Questions about Token Cost

What does Token Cost do?

Measure before optimizing — estimate token counts locally with stated heuristics, price them at your model's rates, and quantify before/after savings, because token optimization without measurement…. Token Cost is an agent skill from mohitagw15856/pm-claude-skills. Measure before optimizing — estimate token counts locally with stated heuristics, price them at your model's rates, and quantify before/after savings, because token optimization without measurement is vibes.

When should I use Token Cost?

Token Cost fits situations like: asked how many tokens is this; what does this context cost per call; is this optimization worth it; compare these two versions cost.

How do I install Token Cost in Claude Code?

Run `npx skills add mohitagw15856/pm-claude-skills --skill token-cost -a claude-code`. Or copy the skill folder (skills/token-cost in mohitagw15856/pm-claude-skills) into .claude/skills/token-cost in your project. Claude Code loads it when a task matches its description.

How do I install Token Cost in Codex?

Run `npx skills add mohitagw15856/pm-claude-skills --skill token-cost -a codex`. Or copy the skill folder (skills/token-cost in mohitagw15856/pm-claude-skills) into .agents/skills/token-cost in your project. Codex loads it when a task matches its description.

Can I use Token Cost in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mohitagw15856/pm-claude-skills --skill token-cost -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/token-cost, .gemini/skills/token-cost, .github/skills/token-cost and .opencode/skills/token-cost in your project.

What does Token Cost need to run?

Going by SKILL.md and its folder, Token Cost needs Python for the scripts in its folder and the command-line tools its instructions call (python3). Our summary lists: Python 3.

Does Token Cost access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Token Cost safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Token Cost use?

Token Cost is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Token Cost use?

About 1.3k tokens (SKILL.md is roughly 5.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Token Cost?

Skills that share tags, products or a category with Token Cost: Context Compression (guanyang/open-agent-hub, 977 stars), Bounty Hunter (1sadjlk/bounty-hunter-skill, 282 stars), Skill Shortener (luongnv89/asm, 955 stars) and Context Audit (undefined-ui/second-brain-os, 1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Token Cost?

mohitagw15856 (a GitHub user) maintains it in mohitagw15856/pm-claude-skills, which has 1,434 GitHub stars. The repository holds 1,348 skills in this directory. The repository was last updated on October 9, 2026.

Source: mohitagw15856/pm-claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.