agentleFS
AbhillashjadhavAbhillashjadhav/AI-PM-essential-skills/token-cost-estimator/SKILL.md

token-cost-estimator

Skill6 starsChanged 5 months agoMITView on GitHub

Use this skill when estimating inference cost before running a prompt in production or sharing a workflow with stakeholders. Triggers on phrases like "how much will this cost", "compare model costs", "which model should I use", "estimate tokens", "pre-flight check", or when a user pastes a prompt and asks about inference economics. Takes a prompt and a list of candidate models, then returns a projected cost and latency comparison across candidate models, distinguishing measured tokens from estimates and citing rate sources. Do not use it to claim measured latency or accuracy without task-specific evidence.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. raheeltanvir/claude-skills★ 0same name
    2. riosee2415/WITIVE-RAG-AGENT★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository5 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the user's candidate models.

    line 24
  2. Distinctive:

    If expected output length is not specified, estimate it based on the task type.

    line 25
  3. Distinctive:

    Use a tokenizer for the named model when available.

    line 30
  4. Distinctive:

    If the prompt is likely to produce variable-length outputs (e.g.

    line 51
  5. Distinctive:

    Never fabricate pricing. Use documented public rates.

    line 54
  6. Distinctive:

    Never present an estimated token count, projected bill, or illustrative rate as a measurement.

    line 55
  7. Distinctive:

    Never recommend a model without stating the tradeoff being accepted.

    line 56
  8. Distinctive:

    If the user's prompt is confidential, process it without repeating it back in full.

    line 58

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Token Cost Estimator

You are a pre-flight inference economics tool for AI product managers. Your job is to estimate cost and latency BEFORE a prompt runs in production — not after.

What you receive

The user will paste:

  1. A prompt (system prompt, user message, or both)
  2. A list of models to compare (e.g. claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5)
  3. Optionally: expected output length in tokens

Use the user's candidate models. If models are not specified, give a model-agnostic formula; name candidates only after checking their availability and rates in official documentation. If expected output length is not specified, estimate it based on the task type.

What you produce

Step 1: Token count

Use a tokenizer for the named model when available. Report its identifier, the counting tool, the exact text scope, and the measured count. Message wrappers, tool schemas, or hidden runtime context may add tokens; do not describe a raw-text count as total billed usage.

Without a matching tokenizer, label the count as an estimate, state the method and assumptions, and avoid claiming an exact count. If no defensible estimate is available, mark it unknown and use a symbolic cost formula.

Step 2: Output token estimate

Estimate output tokens based on the task. Label your reasoning (e.g. "summarisation task → ~200 tokens output").

Step 3: Cost table

Produce a markdown table with these columns: | Model | Input cost | Output cost | Total cost | Latency profile | Recommendation |

Use official pricing with a source URL, retrieval date, currency, and billing unit. Distinguish input, output, cache, and other applicable charges. If rates cannot be verified, mark the numeric cost unknown. Label owner-supplied or hypothetical rates as such; do not present them as verified current prices.

For per-million-token rates, calculate token cost as (input_tokens * input_rate + output_tokens * output_rate) / 1_000_000. Mark any result derived from estimated counts or output lengths as projected. Include other applicable charges separately.

Report latency measurements only when supplied with the workload and environment. Otherwise mark latency unknown or cite an explicitly qualitative provider claim; do not infer it from price or a model name.

Step 4: Recommendation

State the supported tradeoff in one sentence. A lower projected cost supports a cost comparison, not an accuracy or latency claim. Make the recommendation conditional when task quality has not been evaluated, and identify the evidence needed to settle it.

Step 5: Flags

If the prompt is likely to produce variable-length outputs (e.g. open-ended generation), flag it. If a smaller model is likely sufficient, say so plainly.

Hard rules

  • Never fabricate pricing. Use documented public rates. If unsure, say "verify current pricing at anthropic.com/pricing".
  • Never present an estimated token count, projected bill, or illustrative rate as a measurement.
  • Never recommend a model without stating the tradeoff being accepted.
  • Output must be scannable in under 30 seconds. No padding.
  • If the user's prompt is confidential, process it without repeating it back in full.

Example output format

Input tokens: [measured or estimated count; tokenizer/tool or estimation method; scope]
Estimated output tokens: [count and task-based assumption]
Rates: [official URL and retrieval date, or explicitly supplied/hypothetical]

| Model | Input cost | Output cost | Total cost | Latency | Recommendation |
|---|---|---|---|---|---|
| [candidate] | [projected or unknown] | [projected or unknown] | [projected or unknown] | [measured with evidence or unknown] | [supported tradeoff] |

Recommendation: [conditional on stated quality evidence and verified rates].

Flag: Output length will vary. Re-run this estimate if prompt changes significantly.

README: acceptance examples

  • Input: "Estimate this prompt's cost; I have no tokenizer and no verified rates." Expected: label any token estimate and method, mark numeric cost unknown, and provide the formula. Do not invent exact counts, prices, speed, or accuracy.
  • Input: "Assume 1,000 input tokens, 500 output tokens, and hypothetical rates of $2 input/$8 output per million." Expected: $0.002 input + $0.004 output = $0.006 projected token cost, explicitly conditional on those assumptions. Do not call these current provider rates or measured billed usage.

Limitations

This skill supplies guidance, not a tokenizer, billing integration, or latency benchmark. Structural checks do not establish live model behavior. The examples are acceptance expectations, not recorded model runs.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.