usage-estimate
v0.2.0
Published
Token estimation plugin for Claude Code. Shows estimated token count before submission and optionally blocks prompts exceeding a configurable threshold.
Maintainers
Readme
usage-estimate
Token estimation plugin for Claude Code. Shows how many tokens your prompt will consume before it's sent.
Install
Install via the agenthub marketplace:
/plugin marketplace add nullorder/agenthub
/plugin install usage-estimate@agenthubIf you already have agenthub enabled, just run the second command.
To verify it's working, type any prompt and press Enter — you should see an estimated token count (e.g. ~142 tokens) appear as a system message.
What it does
Every prompt you submit shows an estimated token count like ~142 tokens.
If a prompt exceeds the blocking threshold (default: 10,000 tokens), it pauses and asks you to press Enter again to confirm.
Configuration
Set the threshold with a slash command:
/usage-estimate maxToken 5000
/usage-estimate maxToken off
/usage-estimate statusNote: Restart Claude Code after changing the threshold for it to take effect.
Or add to ~/.claude/settings.json manually:
{
"usage-estimate": {
"blockThreshold": 10000
}
}| Value | Behavior |
| ----------------- | ----------------------------------- |
| 10000 (default) | Block prompts over 10k tokens |
| Any number | Block prompts over that many tokens |
| 0 or null | Never block, just show the estimate |
Uninstall
/plugin uninstall usage-estimate@agenthubHow it works
Uses a UserPromptSubmit hook that intercepts prompts after you press Enter but before they're sent to Claude. Tokens are counted locally using js-tiktoken with the gpt-4o (o200k_base) encoding — no API calls, no latency. The count is an approximation (~10-15% margin vs. Claude's actual tokenizer).
