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 Belkinsv1.1.0MITIn 1 marketplace
Estimates the token cost of each tool call against a session budget you set, with warn, confirm or block enforcement. Its hooks check every tool call and say they stay local with no network requests; figures are heuristic, not your invoice.
Trending plugins
7-day copy clicks
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.
1 marketplace, most starred first
token-cost, cost-tracking, budget-limits, cost-estimation, usage-reporting, session-budget, cost, budget ·
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Cost Guardian is a local Claude Code plugin for heuristic tool-event cost estimates and user-configured estimate budgets.
It is deliberately not a billing tracker. Claude Code's general tool hooks provide tool inputs and responses, but not complete conversation token usage or an authoritative account invoice. Cost Guardian estimates the serialized size of observed tool events, converts that size with a rough four-characters-per- token heuristic, and—only when you explicitly select a supported model—applies first-party Claude API list prices.
/plugin marketplace add Belkins/cost-guardian
/plugin install cost-guardian@belkins
Installed commands are namespaced:
/cost-guardian:budget model claude-sonnet-5
/cost-guardian:budget set 10 --enforcement warn
/cost-guardian:cost
/cost-guardian:cost-report
/cost-guardian:cost-optimize
/cost-guardian:cost-share
Requirements: Claude Code 2.1.221 validation baseline, Python 3.10+, macOS or Linux. Hooks execute locally and make no network requests.
tool_input and tool_response sizes observed by successful
PostToolUse events.PreToolUse budget checks.It does not include or prove:
Pricing is dated 2026-08-04 and sourced only from Anthropic's models overview and pricing documentation. The plugin supports these documented Claude API IDs:
| Model ID | Standard input / MTok | Standard output / MTok |
|---|---|---|
claude-fable-5 | $10 | $50 |
claude-opus-5 | $5 | $25 |
claude-sonnet-5 | $2 through 2026-08-31; $3 after | $10 through 2026-08-31; $15 after |
claude-haiku-4-5-20251001 | $1 | $5 |
claude-haiku-4-5 | alias of the dated Haiku ID | alias |
Unknown or currently unpriced IDs fail closed: USD estimation and estimate- budget enforcement remain unavailable. The plugin never substitutes another model's rate.
The default is warn. confirm asks before a tool event whose prospective
estimate would exceed the session estimate budget. block denies that event.
Because the metric is approximate, use block only when a conservative local
guard is appropriate.
/cost-guardian:budget set 5 --enforcement warn
/cost-guardian:budget set 5 --enforcement confirm
/cost-guardian:budget set 5 --enforcement block
/cost-guardian:budget reset
These are local estimate controls, not Anthropic Console spend limits.
State is stored only in ${CLAUDE_PLUGIN_DATA}, the persistent plugin data
directory documented by Claude Code. The runtime has no fallback to HOME.
On first use, it may copy known JSON from the old
~/.claude/cost-guardian/ location:
legacy-v1/ and are not mixed
into new estimate totals;State access walks absolute paths with no-follow directory descriptors, accepts only strict directory/file names, locks read-modify-write operations, and uses same-directory atomic replacement. Root, intermediate, and leaf symlinks are refused.
Claude Code deletes ${CLAUDE_PLUGIN_DATA} on final-scope uninstall by default;
use --keep-data if you intend to preserve it. The legacy directory remains
untouched either way.
No tool input or response content is persisted. Operation records contain only
the tool name, timestamp, heuristic size counts, and an optional USD estimate.
Nothing is uploaded; /cost-share produces copyable local text or JSON only.
7-day copy clicks
Plugins from other owners that cover similar ground
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.
npx claudepluginhub belkins/cost-guardian --plugin cost-guardian