Token estimation plugin for Claude Code. Shows how many tokens your prompt will consume before it's sent.
Install via the agenthub marketplace:
/plugin marketplace add nullorder/agenthub
/plugin install usage-estimate@agenthub
If 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.
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.
Set the threshold with a slash command:
/usage-estimate maxToken 5000
/usage-estimate maxToken off
/usage-estimate status
Note: 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 |
/plugin uninstall usage-estimate@agenthub
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).