# Send TokenGuard to your agent
Use the source page and any available docs to guide the install because the item currently does not return a direct package file.
## Fast path
- Open the source page via Open source listing.
- If you can obtain the package, extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the source page and extracted files.
## Suggested prompts
### New install

```text
I tried to install a skill package from Yavira, but the item currently does not return a direct package file. Inspect the source page and any extracted docs, then tell me what you can confirm and any manual steps still required.
```
### Upgrade existing

```text
I tried to upgrade a skill package from Yavira, but the item currently does not return a direct package file. Compare the source page and any extracted docs with my current installation, then summarize what changed and what manual follow-up I still need.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "tokenguard",
    "name": "TokenGuard",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/G0HEAD/tokenguard",
    "canonicalUrl": "https://clawhub.ai/G0HEAD/tokenguard",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/tokenguard",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=tokenguard",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "scripts/tokenguard.py",
      "skill.json"
    ],
    "downloadMode": "manual_only",
    "sourceHealth": {
      "source": "tencent",
      "slug": "tokenguard",
      "status": "source_issue",
      "reason": "not_found",
      "recommendedAction": "review_source",
      "checkedAt": "2026-05-10T03:14:31.534Z",
      "expiresAt": "2026-05-11T03:14:31.534Z",
      "httpStatus": 404,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=tokenguard",
      "contentType": "text/plain",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=tokenguard",
        "contentDisposition": null,
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "tokenguard"
      },
      "scope": "item",
      "summary": "Known item issue.",
      "detail": "This item's current download entry is known to bounce back to a listing or homepage instead of returning a package file.",
      "primaryActionLabel": "Open source listing",
      "primaryActionHref": "https://clawhub.ai/G0HEAD/tokenguard"
    },
    "validation": {
      "installChecklist": [
        "Open the source listing and confirm there is a real package or setup artifact available.",
        "Review SKILL.md before asking your agent to continue.",
        "Treat this source as manual setup until the upstream download flow is fixed."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/tokenguard",
    "downloadUrl": "https://openagent3.xyz/downloads/tokenguard",
    "agentUrl": "https://openagent3.xyz/skills/tokenguard/agent",
    "manifestUrl": "https://openagent3.xyz/skills/tokenguard/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/tokenguard/agent.md"
  }
}
```
## Documentation

### 🛡️ 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
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: G0HEAD
- Version: 1.0.0
## Source health
- Status: source_issue
- Known item issue.
- This item's current download entry is known to bounce back to a listing or homepage instead of returning a package file.
- Health scope: item
- Reason: not_found
- Checked at: 2026-05-10T03:14:31.534Z
- Expires at: 2026-05-11T03:14:31.534Z
- Recommended action: Open source listing
## Links
- [Detail page](https://openagent3.xyz/skills/tokenguard)
- [Send to Agent page](https://openagent3.xyz/skills/tokenguard/agent)
- [JSON manifest](https://openagent3.xyz/skills/tokenguard/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/tokenguard/agent.md)
- [Download page](https://openagent3.xyz/downloads/tokenguard)