โ† All skills
Tencent SkillHub ยท Developer Tools

TokenGuard

API cost guardian for AI agents. Track spending, enforce limits, prevent runaway costs. Essential for any agent making paid API calls.

skill openclawclawhub Free
0 Downloads
0 Stars
0 Installs
0 Score
High Signal

API cost guardian for AI agents. Track spending, enforce limits, prevent runaway costs. Essential for any agent making paid API calls.

โฌ‡ 0 downloads โ˜… 0 stars Unverified but indexed

Install for OpenClaw

Quick setup
  1. Download the package from Yavira.
  2. Extract the archive and review SKILL.md first.
  3. Import or place the package into your OpenClaw setup.

Requirements

Target platform
OpenClaw
Install method
Manual import
Extraction
Extract archive
Prerequisites
OpenClaw
Primary doc
SKILL.md

Package facts

Download mode
Yavira redirect
Package format
ZIP package
Source platform
Tencent SkillHub
What's included
SKILL.md, scripts/tokenguard.py, skill.json

Validation

  • Use the Yavira download entry.
  • Review SKILL.md after the package is downloaded.
  • Confirm the extracted package contains the expected setup assets.

Install with your agent

Agent handoff

Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.

  1. Download the package from Yavira.
  2. Extract it into a folder your agent can access.
  3. Paste one of the prompts below and point your agent at the extracted folder.
New install

I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.

Upgrade existing

I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.

Trust & source

Release facts

Source
Tencent SkillHub
Verification
Indexed source record
Version
1.0.0

Documentation

ClawHub primary doc Primary doc: SKILL.md 13 sections Open source page

๐Ÿ›ก๏ธ TokenGuard โ€” API Cost Guardian

Protect your wallet from runaway API costs. TokenGuard tracks your agent's spending per session, enforces configurable limits, and alerts you before you blow your budget.

Why TokenGuard?

AI agents can rack up serious API costs fast. One runaway loop = hundreds of dollars. TokenGuard gives you: Session-based tracking โ€” Costs reset daily (or on demand) Hard limits โ€” Actions blocked when budget exceeded Pre-flight checks โ€” Verify budget BEFORE expensive calls Override controls โ€” Extend limits or bypass when needed Full audit trail โ€” Every cost logged with timestamps

Installation

clawhub install tokenguard Or manually: mkdir -p ~/.openclaw/workspace/skills/tokenguard # Copy SKILL.md and scripts/tokenguard.py chmod +x scripts/tokenguard.py

Quick Start

# Check current status python3 scripts/tokenguard.py status # Set a $20 limit python3 scripts/tokenguard.py set 20 # Before an expensive call, check budget python3 scripts/tokenguard.py check 5.00 # After the call, log actual cost python3 scripts/tokenguard.py log 4.23 "Claude Sonnet - code review" # View spending history python3 scripts/tokenguard.py history

Commands

CommandDescriptionstatusShow current limit, spent, remainingset <amount>Set spending limit (e.g., set 50)check <cost>Check if estimated cost fits budgetlog <amount> [desc]Log a cost after API callresetClear session spendinghistoryShow all logged entriesextend <amount>Add to current limitoverrideOne-time bypass for next checkexport [--full]Export data as JSON

Exit Codes

0 โ€” Success / within budget 1 โ€” Budget exceeded (check command) 2 โ€” Limit exceeded after logging Use exit codes in scripts: if python3 scripts/tokenguard.py check 10.00; then # proceed with expensive operation else echo "Over budget, skipping" fi

Budget Exceeded Alert

When a check would exceed your limit: ๐Ÿšซ BUDGET EXCEEDED โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ Current spent: $ 4.0000 โ”‚ โ”‚ This action: $ 10.0000 โ”‚ โ”‚ Would total: $ 14.0000 โ”‚ โ”‚ Limit: $ 10.00 โ”‚ โ”‚ Over by: $ 4.0000 โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ๐Ÿ’ก Options: tokenguard extend 5 # Add to limit tokenguard set <amt> # Set new limit tokenguard reset # Clear session tokenguard override # One-time bypass

Integration Pattern

For agents using paid APIs: import subprocess import sys def check_budget(estimated_cost: float) -> bool: """Check if action fits budget.""" result = subprocess.run( ["python3", "scripts/tokenguard.py", "check", str(estimated_cost)], capture_output=True ) return result.returncode == 0 def log_cost(amount: float, description: str): """Log actual cost after API call.""" subprocess.run([ "python3", "scripts/tokenguard.py", "log", str(amount), description ]) # Before expensive operation if not check_budget(5.00): print("Budget exceeded, asking user...") sys.exit(1) # Make API call response = call_expensive_api() # Log actual cost log_cost(4.23, "GPT-4 code analysis")

Configuration

Environment variables: VariableDefaultDescriptionTOKENGUARD_DIR~/.tokenguardStorage directoryTOKENGUARD_DEFAULT_LIMIT20.0Default limit in USDTOKENGUARD_WARNING_PCT0.8Warning threshold (0-1)

Cost Reference

Common API pricing (per 1M tokens): ModelInputOutputClaude 3.5 Sonnet$3$15Claude 3 Haiku$0.25$1.25GPT-4o$2.50$10GPT-4o-mini$0.15$0.60GPT-4-turbo$10$30 Rule of thumb: 1000 tokens โ‰ˆ 750 words

Storage

Data stored in ~/.tokenguard/ (or TOKENGUARD_DIR): limit.json โ€” Current limit configuration session.json โ€” Today's spending + entries override.flag โ€” One-time bypass flag

Best Practices

Set realistic limits โ€” Start with $10-20 for development Check before expensive calls โ€” Always check before big operations Log everything โ€” Even small costs add up Use extend, not reset โ€” Keep audit trail intact Monitor warnings โ€” 80% threshold = time to evaluate

v1.0.0

Initial release Core commands: status, set, check, log, reset, history, extend, override Environment variable configuration JSON export for integrations Daily auto-reset Built by PaxSwarm โ€” a murmuration-class swarm intelligence

Category context

Code helpers, APIs, CLIs, browser automation, testing, and developer operations.

Source: Tencent SkillHub

Largest current source with strong distribution and engagement signals.

Package contents

Included in package
1 Docs1 Scripts1 Config
  • SKILL.md Primary doc
  • scripts/tokenguard.py Scripts
  • skill.json Config