token-usage-cost-report
Skill0 starsChanged 35 days agoMITView on GitHub
Use when an agent must produce an auditable token-usage and cost report from structured runtime evidence, normalized usage bundles, or repository-level report sets. This skill discovers trustworthy evidence, resolves official pricing, refuses transcript-only estimation, and generates provenance-backed Markdown, HTML, and JSON artifacts with explicit exact, partial, estimated, or unsupported cost labels.
We split this skill into the rules it gives an agent
24 rules. About 0 are common, 23 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈23
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Use this skill when the user wants a trustworthy token-consumption or cost report for one or more agent sessions, tasks, or repositories.
- Distinctive: line 31
use blog posts, screenshots, or memory-based prices
- Distinctive: line 34
treat host tools like VS Code as the billing source
- Very specific: line 36
When the user wants the story of how a result was built (the prompts, the model choices, a rough cost for a colleague), use the …
- Distinctive: line 61
If the user only provides transcript text or screenshots, refuse token and cost estimation and explain that structured usage evidence is …
- Distinctive: line 65
Use direct parsing only when the runtime is directly supported by the bundled parser.
- Distinctive: line 67
Read runtime-support.md only when you need to decide whether a runtime is:
- Distinctive: line 74
Use the normalized usage contract when trustworthy exports exist but a direct parser is not bundled.
- Distinctive: line 90
Use the bundled examples and schemas when building inputs:
- Distinctive: line 98
Run discovery first when the user names a timeframe or runtime but not exact files:
- Distinctive: line 105
When the work targets Google Antigravity repositories, inventory evidence before full reporting:
- Distinctive: line 113
Treat Antigravity evidence as heuristic unless exact token fields are exposed.
- Distinctive: line 122
When local coverage is missing, fetch official pricing with the bundled helper:
- Distinctive: line 132
Read pricing-sources.md only when you need official source rules or billing caveats.
- Distinctive: line 213
Read report-contract.md only when you need the detailed artifact contract.
- Distinctive: line 217
Use these labels exactly:
- Distinctive: line 224
Never collapse these labels into a single ambiguous “cost calculated” claim.
- Distinctive: line 228
Every final report should include a concise, non-technical overview that explains:
- Distinctive: line 235
Keep the narrative grounded in explicit evidence such as task labels, prompts, outcomes, runtime metadata, and source paths.
- Distinctive: line 239
Before replying to the user:
- Distinctive: line 244
Read troubleshooting.md only when warnings or partial support need interpretation.
- Distinctive: line 265
Do not automatically promote runtime observations into shared or persistent memory.
- Distinctive: line 269
If the workflow becomes unreliable:
- Distinctive: line 289
Use direct Codex parsing plus a normalized Gemini bundle, then emit one combined report with runtime-specific warnings if needed.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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.
Files
Token Usage Cost Report
Author: jovd83 | Version: 1.2.2 | License:
Use this skill when the user wants a trustworthy token-consumption or cost report for one or more agent sessions, tasks, or repositories.
What This Skill Does
This skill helps an agent:
- discover supported runtime evidence
- accept normalized usage bundles for unsupported runtimes
- validate pricing and usage inputs
- fetch official provider pricing when local coverage is missing
- generate auditable Markdown, HTML, and JSON reports
- generate repository dashboards when many report directories already exist
What This Skill Must Not Do
Do not:
- estimate token counts from transcript text alone
- use blog posts, screenshots, or memory-based prices
- silently remap an unknown model to a different exact pricing row
- claim exact cost when pricing dimensions remain unresolved
- treat host tools like VS Code as the billing source
When the user wants the story of how a result was built (the prompts, the model choices, a rough cost for a colleague), use the how-did-you-do-that skill instead. It estimates from transcripts and labels the figure as an estimate. This skill is for auditable figures.
Operating Model
Work in five stages:
- Confirm scope and evidence type.
- Validate or discover evidence.
- Resolve pricing from official or validated local sources.
- Generate the report artifacts.
- Review the output and respond with grounded caveats.
1. Confirm Scope
Accept inputs such as:
- a single session file
- a session directory
- a date-scoped directory of sessions
- a manifest describing multiple sources
- a normalized usage bundle
- a repository reports directory for dashboard generation
Interpret complete task as a finished unit of work with a clear start and end in structured evidence.
If the user only provides transcript text or screenshots, refuse token and cost estimation and explain that structured usage evidence is required.
2. Identify The Evidence Mode
Use direct parsing only when the runtime is directly supported by the bundled parser.
Read runtime-support.md only when you need to decide whether a runtime is:
- directly supported
- normalization-only
- host-only
- unsupported
Use the normalized usage contract when trustworthy exports exist but a direct parser is not bundled.
3. Validate Inputs Before Reporting
Validate local pricing tables before use:
python scripts/validate_pricing_table.py path\to\pricing-table.jsonValidate normalized usage bundles before use:
python scripts/validate_normalized_usage.py path\to\normalized-usage.jsonUse the bundled examples and schemas when building inputs:
- normalized-usage.example.json
- normalized-usage.schema.json
- pricing-table.schema.json
4. Discover Evidence When Sources Are Not Exact
Run discovery first when the user names a timeframe or runtime but not exact files:
python scripts/token_usage_cost_report.py discover
python scripts/token_usage_cost_report.py discover --jsonWhen the work targets Google Antigravity repositories, inventory evidence before full reporting:
python scripts/build_antigravity_evidence_inventory.py `
--projects-root C:\projects\antigravity_prj `
--output-dir C:\reports\antigravity-evidence-inventoryTreat Antigravity evidence as heuristic unless exact token fields are exposed.
5. Resolve Pricing Safely
Prefer:
- official provider pricing pages
- validated local pricing tables copied from official sources
When local coverage is missing, fetch official pricing with the bundled helper:
python scripts/fetch_official_pricing.py `
--provider openai `
--provider anthropic `
--provider google `
--output path\to\official-pricing.jsonRead pricing-sources.md only when you need official source rules or billing caveats.
6. Choose The Right Reporting Path
Direct source reporting
python scripts/token_usage_cost_report.py report `
--source C:\Users\me\.codex\sessions\2026\03\27 `
--pricing C:\reports\pricing\official-pricing.json `
--output-dir C:\reports\token-usage `
--format bothClaude Code reporting (Anthropic models)
Claude Code stores per-turn usage at %USERPROFILE%\.claude\projects\<encoded-cwd>\<session>.jsonl.
Convert one or more sessions/projects to a normalized bundle, then report:
python scripts/parse_claude_code_session.py `
$env:USERPROFILE\.claude\projects\c--projects-myrepo `
--runtime-host claude-code-cli `
--output C:\reports\claude\bundle.json
python scripts/validate_normalized_usage.py C:\reports\claude\bundle.json
python scripts/token_usage_cost_report.py report `
--source C:\reports\claude\bundle.json `
--pricing C:\reports\pricing\official-pricing.json `
--output-dir C:\reports\claude\report `
--format bothAnthropic pricing rows produced by fetch_official_pricing.py cover Opus 4.5–4.7,
Sonnet 4–4.6, and Haiku 4.5, including the four billing dimensions:
input_per_million, cached_input_per_million (cache read / hit),
cache_write_5m_per_million, and cache_write_1h_per_million. Date-suffix
model ids such as claude-haiku-4-5-20251001 fall back to the canonical alias
automatically.
Manifest-driven reporting
python scripts/token_usage_cost_report.py report `
--manifest assets/source-manifest.example.jsonNormalized usage reporting
python scripts/token_usage_cost_report.py report `
--source assets/normalized-usage.example.json `
--pricing C:\reports\pricing\official-pricing.json `
--output-dir C:\reports\mixed-runtime-reportRepository dashboard generation
python scripts/build_repository_dashboard.py `
--reports-root path\to\repository-reports `
--output path\to\repository-reports\index.html7. Output Contract
The main report command should produce:
report.mdreport.htmlreport.data.jsonreport.sources.json
The report must preserve:
- exact source paths used
- pricing table path used
- official pricing URLs embedded in the resolved pricing table
- warnings for skipped files, unsupported runtimes, unmatched models, and unresolved billing dimensions
Read report-contract.md only when you need the detailed artifact contract.
8. Cost Confidence Rules
Use these labels exactly:
exact: all observed token categories are covered by the matched pricing rowestimated: a missing cost component was estimated from peer pricing in the supplied pricing tablepartial: observed token categories or billing modifiers remain unresolvedunsupported: no trustworthy pricing row matched
Never collapse these labels into a single ambiguous “cost calculated” claim.
9. Narrative Requirements
Every final report should include a concise, non-technical overview that explains:
- what the user asked for
- what work or sessions were analyzed
- why tokens were consumed
- how many user prompts and completed task cycles were observed
Keep the narrative grounded in explicit evidence such as task labels, prompts, outcomes, runtime metadata, and source paths.
10. Review Before Responding
Before replying to the user:
- Open
report.mdfor a human-readable summary. - Open
report.sources.jsonto confirm provenance. - Open
index.htmlwhen you generated a repository dashboard. - Read troubleshooting.md only when warnings or partial support need interpretation.
Gotchas
Watch for these common mistakes:
- transcript text, screenshots, and chat summaries are not valid token or cost evidence
- host tooling metadata may describe where work happened, but it does not prove who billed the tokens
- an approximate model name is not enough for exact pricing unless the pricing row clearly matches
partialandunsupportedare correct outcomes when pricing coverage is incomplete or untrustworthy- Antigravity imports should stay heuristic unless exact token fields are present in the evidence
- a local pricing table is only trustworthy when it was copied from official provider sources and validated before use
Memory Model
Use memory deliberately:
- Runtime memory: evidence paths, extracted tasks, pricing resolution, warnings, and the active reporting state for the current run only.
- Project-local persistent memory: generated reports written to the chosen output directory.
- Shared memory: out of scope. If cross-agent reuse is required, use the agent's own memory (for example CLAUDE.md or AGENTS.md) rather than embedding that concern here.
Do not automatically promote runtime observations into shared or persistent memory.
Failure Handling
If the workflow becomes unreliable:
- missing structured usage evidence: stop and explain why transcript-only costing is refused
- invalid pricing table: validate and repair it before continuing
- invalid normalized usage bundle: validate and repair it before continuing
- missing pricing coverage: fetch official pricing or keep cost labeled partial or unsupported
- heuristic-only evidence: continue only with explicit warnings and clear non-exact labels
Example Request Mapping
Input:
Create a cost report for this Codex session.
Result: Generate report artifacts from structured Codex evidence with matched pricing rows and provenance.
Input:
Combine these Gemini and Codex sessions into one report.
Result: Use direct Codex parsing plus a normalized Gemini bundle, then emit one combined report with runtime-specific warnings if needed.
Input:
Build a TV-friendly dashboard for all repository reports.
Result: Generate the repository dashboard and wallboard entry point from existing per-repository reports.
Resource Map
- README: README.md
- Report contract: references/report-contract.md
- Runtime support: references/runtime-support.md
- Source trust rules: references/source-trust-rules.md
- Pricing rules: references/pricing-sources.md
- Troubleshooting: references/troubleshooting.md
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
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.

