Claude Tokens Plugin
PeterCang/claude-tokens-plugin
Analise consumo de tokens, custos e eficiência de cache em projetos Claude
Ver no GitHubPlugin para Claude Code que adiciona o comando /tokens:tokens para gerar relatórios detalhados de uso histórico de tokens e custos por modelo, projeto e data. Analisa sessões locais, cache efficiency e tendências de consumo com estimativas de custo baseadas em pricing oficial da Anthropic.
Instalação
npx convez-ai PeterCang/claude-tokens-plugin1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Monitorar gastos com API Anthropic por projeto e período
- Entender padrões de consumo de tokens e hit rates de cache
- Comparar custos reais vs hipotéticos sem cache
- Identificar top projects e modelos que mais consomem tokens
- Acompanhar tendências de uso semana a semana
Veredito

Ferramenta essencial para quem usa Claude Code intensivamente e precisa controlar custos de API. Executa localmente sem dependências externas, com pricing atualizado e análises abrangentes de cache efficiency.
README
A tradução para o português deste README ainda está na fila.
claude-tokens-plugin
A Claude Code plugin that adds a /tokens:tokens command to report your complete historical token usage and cost breakdown across all local projects.
Install
claude plugin marketplace add PeterCang/claude-tokens-plugin
claude plugin install tokens@claude-tokens-plugin --scope user
Then use it in any Claude Code session:
/tokens:tokens
Update
claude plugin update tokens@claude-tokens-plugin
This updates both the skill and the bundled token_stats.py script.
Uninstall
claude plugin uninstall tokens@claude-tokens-plugin
claude plugin marketplace remove claude-tokens-plugin
Migrate from old name (claude-tokens-skill)
If you installed the old claude-tokens-skill version, run this once to migrate:
claude plugin uninstall tokens@claude-tokens-skill
claude plugin marketplace remove claude-tokens-skill
claude plugin marketplace add PeterCang/claude-tokens-plugin
claude plugin install tokens@claude-tokens-plugin --scope user
What it shows
- Today's usage — token breakdown by project for the current day, with cost
- Overview — active period, projects, sessions, avg session duration & messages
- Token breakdown — input / cache_write / cache_read / output with percentages
- Cost estimate — actual cost vs hypothetical no-cache cost, daily & per-session averages
- Cache efficiency — hit rate and visual bar charts
- By model — token counts and cost per model (Sonnet, Opus, Haiku…)
- Tool call ranking — which tools (Read, Bash, Edit…) you use most
- By project — top 15 projects by token consumption and cost
- Weekly trend — week-by-week usage with bar chart
- By date — top 20 days by consumption
- Pricing reference — full Anthropic pricing table embedded in the script
Requirements
- Claude Code with session history in
~/.claude/projects/ - Python 3.9+ (no extra packages needed)
Notes
- Cost estimates use Anthropic's official API pricing (embedded in
token_stats.py, last updated 2026-04). Update thePRICINGdict if prices change. - Non-Anthropic models fall back to Sonnet 4.6 pricing — treat those as rough estimates.
- The script deduplicates retried messages to avoid double-counting.
License
MIT