Token Counter for Claude Code shows what your Claude Code usage would cost at Anthropic's API list prices, and how it filled your weekly limit: it charts your usage within each weekly all-model limit window it observed, alongside the quota readings Claude Code recorded, and its JSON output attributes each window to Pro, Max 5x or Max 20x when the account observations it captured support that. The
npx mdskills install stdcmms-lang/token-counterRelated
1# Token Counter for Claude Code23Token Counter for Claude Code shows what your Claude Code usage would cost at Anthropic's API4list prices, and how it filled your weekly limit: it charts your usage within each weekly5all-model limit window it observed, alongside the quota readings Claude Code recorded, and its6JSON output attributes each window to Pro, Max 5x or Max 20x when the account observations it7captured support that. The report is a local HTML page built from the transcripts Claude Code8keeps on your machine and the history the plugin retains, with input, output, cache reads and9response times. By default, prices come from a table bundled with the plugin and nothing is10fetched, and making the report sends nothing. A Codex edition, `token-counter`, is in the same11repository.1213Sharing is separate and opt-in. The token-share skill can publish your totals and a sanitized14copy of the report page to the public leaderboard at15[tokenusage.dev](https://tokenusage.dev/token-report). Its default is a dry run that sends nothing;16publishing needs `--yes`.1718## Install1920```text21claude plugin marketplace add stdcmms-lang/token-counter22claude plugin install token-counter-claude@stdcmms-lang23```2425Then ask Claude Code for a usage report, or run `/token-counter-claude:token-report`.26`/token-counter-claude:token-share` previews a share without sending anything.2728## Run a task with an Anthropic API key2930```text31/token-counter-claude:cc-api Read README.md and summarize it in five bullets.32```3334The cc-api skill runs your installed `claude -p` in the current working35directory with CC_API_KEY, or the stripped contents of the UTF-8 file named36by CC_API_KEY_FILE. Configure the key privately in your shell profile on37macOS/Linux, or using setx or your PowerShell profile on Windows, and restart38the calling application. The skill never asks for a key in chat.3940Options are `--model ID` and `--allow-edits`; the latter passes only41`--permission-mode acceptEdits`. Tasks go to stdin, including multiline42tasks on Windows .cmd launchers. Model IDs must match43`^[A-Za-z0-9._:\[\]-]{1,100}$`. Python 3.8+, Claude Code on PATH,44network access and an Anthropic API key are required.4546Billing belongs to the key's Console organization. Eligible self-run47print-mode usage can draw on monthly API credits claimed into that48organization by a Max or Team plan, under Anthropic's rules. Normal API49rates apply when those credits do not cover the run. Interactive Claude50Code and extra plan usage are not covered, and Anthropic excludes certain51app, IDE and GitHub Action launches. Check52[Console Billing](https://platform.claude.com/settings/billing).5354The calling session keeps its login and plan. The helper writes no files55and changes no login/configuration files; the child CLI can read workspace56context, run tools and write its own session files. It returns the final57result, child-reported cost, turns and model.5859The skill uses Bash background execution for long tasks. Agent background60lifecycle behavior is UNVERIFIED by the saved repository evidence.6162## What it reads, runs and sends6364Paths below are the defaults. A nonempty `CLAUDE_CONFIG_DIR` moves `~/.claude` to that65directory and `~/.claude.json` into it.6667- **Reads:** Claude Code transcripts under `~/.claude/projects`, the plugin's own state under68 `~/.claude/token-counter/`, the bundled price table, and five allow-listed `oauthAccount`69 fields from `~/.claude.json`: the plan fields (`organizationType`,70 `organizationRateLimitTier`, `subscriptionCreatedAt`) and the email or organization name that71 labels your local report. `--no-account` skips that file. It does not open Claude's72 credential files, such as `~/.claude/.credentials.json`.73- **Writes:** in `~/.claude/token-counter/`: a history database, an index cache, the report74 pages and, after a first share, `claude-share.json`. Deleting a share keeps this local75 history.76- **Runs:** three stdlib Python entrypoints, `report.py`, `share.py` and77 `cc_api.py`, on Python 3.8 or later. Reporting can use local worker78 processes and open the finished page with the platform handler.79 cc-api launches your own installed Claude Code CLI for one requested task.80 The Python helpers install no packages.81- **Report/share sends:** nothing, unless token-share runs with `--yes`. Then it posts JSON to82 `https://tokenusage.dev/api` (or the API base set with `--api` or `TOKENUSAGE_API`, which83 must be HTTPS, or HTTP to a loopback address for testing) and uploads the sanitized report84 page, which `--no-report` leaves out. The JSON holds your public handle, daily recorded token85 counts, selected session summaries keyed by a one-way hash (dates, start and end times,86 active time, counts and model), weekly limit windows (plan, percentages and counts) and87 recent response-time summaries. Prompts, outputs, thinking, tool arguments and results, tool88 names, file names and paths, working directories, session titles, raw session IDs and89 account identity are not sent, and neither are hour-of-day or weekday breakdowns, though90 session start and end times are. The first share returns a token, kept in91 `claude-share.json`; updates and deletions send it to prove the entry is yours, so keep it92 private. `--delete-report --yes` takes the page down, and `--delete --yes` removes everything93 you shared.9495- **cc-api sends:** the requested task and workspace/tool context selected96 by your installed Claude Code CLI to Anthropic for the API run. The helper97 passes the key only in the child's ANTHROPIC_API_KEY environment variable.98 It sends nothing to tokenusage.dev. Your CLI retains its existing99 configuration and proxy behavior.100101Full documentation:102[github.com/stdcmms-lang/token-counter](https://github.com/stdcmms-lang/token-counter#claude-code).103MIT licence.104
Full transparency — inspect the skill content before installing.