Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By bifrost-mcpv1.0.0MIT
Real-time token cost tracking and budget enforcement for Claude Code. See exactly what each session costs, set daily/session budgets, and get warned before you overspend.
You run one by typing its /name in Claude Code.
1 critical · 2 cautions to review before installing
A hook runs before every tool call and can block or approve it
A hook runs when Claude uses the Bash tool
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
cost-tracking, budget, tokens, usage, monitoring, anthropic, claude-code
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Real-time token cost tracking and budget enforcement for Claude Code.
See exactly what each session costs. Set daily and session budgets. Get warned before you overspend.
💰 Session: $2.34 | Today: $8.91 / $20.00 (45%)
Claude Code doesn't show you what you're spending in real time. You find out at the end of the month when the bill arrives. By then you've burned through $200+ without realizing it.
Cost Guardian uses Claude Code's hooks system to:
git clone https://github.com/bifrost-mcp/cost-guardian.git ~/.claude/tools/cost-guardian
npm install -g cost-guardian
If using npm, find the install path for the next step:
echo "$(npm root -g)/cost-guardian"
Add the following to your ~/.claude/settings.json. If using npm, replace ~/.claude/tools/cost-guardian with the path from the command above.
{
"hooks": {
"SessionStart": [
{
"matcher": ".*",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/tools/cost-guardian/hooks/scripts/session-start-init.sh"
}
]
}
],
"PreToolUse": [
{
"matcher": ".*",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/tools/cost-guardian/hooks/scripts/pre-tool-budget-check.sh"
}
]
}
],
"PostToolUse": [
{
"matcher": ".*",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/tools/cost-guardian/hooks/scripts/post-tool-tracker.sh"
}
]
}
],
"Stop": [
{
"matcher": ".*",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/tools/cost-guardian/hooks/scripts/session-end-summary.sh"
}
]
}
]
}
}
Note: If you already have hooks in your settings.json, merge the arrays — don't replace them. Multiple hooks can coexist under the same event.
Cost Guardian activates automatically. You'll see cost tracking after your next tool call:
💰 Session: $0.12 | Today: $0.12 / $20.00 (1%)
Use the /cost command in any session:
=== CURRENT SESSION ===
Session ID: f8053578-cb...
Cost: $2.34
API calls: 47
=== TODAY ===
Total cost: $8.91
API calls: 203
=== THIS WEEK ===
Total cost: $34.67
API calls: 892
=== COST BY MODEL (TODAY) ===
Model Calls Cost Input Tok Output Tok
claude-opus-4-6 12 $5.23 45,200 8,300
claude-sonnet-4-5 156 $3.12 892,000 134,000
claude-haiku-4-5 35 $0.56 234,000 67,000
=== BUDGET STATUS ===
Daily: $8.91 / $20.00 ████░░░░░░ 45% 🟢
Session: $2.34 / $5.00 ████░░░░░░ 47% 🟢
Edit ~/.cost-guardian/config.json (created automatically on first run):
{
"daily_budget": 20.00,
"session_budget": 5.00,
"warn_threshold": 0.80,
"block_threshold": 0.95,
"currency": "USD"
}
| Setting | Default | Description |
|---|---|---|
daily_budget | 20.00 | Maximum daily spend in USD |
session_budget | 5.00 | Maximum per-session spend in USD |
warn_threshold | 0.80 | Show warning at this % of budget |
block_threshold | 0.95 | Block tool use at this % of budget |
| Budget Used | Behavior |
|---|---|
| < 80% | Silent — cost shown after each tool call |
| 80-95% | Warning — yellow alert with spend details |
| > 95% | Blocked — tool use denied with reason |
To unblock, increase the budget in ~/.cost-guardian/config.json or wait for the next day (daily budget resets at midnight UTC).
Cost Guardian uses Claude Code's hooks system to intercept lifecycle events:
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
Generated from the plugin's indexed repository (bifrost-mcp/cost-guardian) — no native marketplace selected
npx claudepluginhub p/bifrost-mcp-cost-guardianPlugins from other owners that cover similar ground