Skip to content
Back to skills

Token Guard

ASecurity

Monitor and control OpenClaw token usage and costs. Set daily budgets, track spending, auto-downgrade models when limits hit. Stop burning money while you sleep.

  • 225 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 4, 2026
ai-agentspythonbashrailsgit

Security analysis

A100/100

Pro scans all 13 files and shows the line behind each finding

Scanned September 4, 2026

npx -y skills add NeverSight/skills_feed --skill token-guard --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Token Guard?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Token Guard
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/neversight-token-guard/badge)](https://www.skillsdirectory.com/skills/neversight-token-guard)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: token-guard
description: Monitor and control OpenClaw token usage and costs. Set daily budgets, track spending, auto-downgrade models when limits hit. Stop burning money while you sleep.
metadata:
  openclaw:
    emoji: "💰"
---

# Token Guard 💰

**Stop burning money while you sleep.**

Your AI agent runs 24/7. Opus costs $75/M output tokens. One overnight coding session can burn $50+ before you wake up. Token Guard watches your spend and acts before your wallet notices.

## The Problem

Real costs from real users:

| Scenario | Model | Cost |
|---|---|---|
| "Let the agent run overnight" | Opus | $50-100 |
| "Register an email + X account" | Opus | $55 (one task!) |
| First week exploring | Opus | $100+ |
| Daily heartbeat checks | Opus | $2-5/day for nothing |

Most users don't realize they're burning Opus-level tokens on tasks that Haiku could handle.

## What Token Guard Does

### Monitor
- Track token usage per day/model
- Estimate costs from model pricing
- Show usage history and trends

### Budget
- Set daily spending limits
- Warning alerts at configurable threshold (default 80%)
- Hard limits with auto-model-downgrade

### Optimize
- Model cost comparison at a glance
- Routing recommendations (Opus for reasoning, Haiku for background)
- Per-task cost estimation before running

## Quick Start

```bash
# See current usage and model costs
bash scripts/token-guard.sh status

# Set a $10/day budget with warnings
bash scripts/token-guard.sh set-budget 10

# Set a hard limit: auto-downgrade to Haiku when exceeded
bash scripts/token-guard.sh set-budget 10 80 true claude-haiku-3-5

# Estimate cost before running a task
bash scripts/token-guard.sh estimate claude-opus-4 50000 10000 10

# Check usage history
bash scripts/token-guard.sh history 7
```

## Model Cost Comparison

| Model | Input $/1M | Output $/1M | Relative |
|---|---|---|---|
| Claude Opus 4 | $15.00 | $75.00 | 100x |
| Claude Sonnet 4 | $3.00 | $15.00 | 20x |
| Claude Haiku 3.5 | $0.80 | $4.00 | 5x |
| GPT-4o | $2.50 | $10.00 | 13x |
| Gemini Flash | $0.075 | $0.30 | 1x |
| DeepSeek | $0.27 | $1.10 | 1.5x |

## Recommended Routing

```
Tier 1 (Reasoning/Creative):  claude-opus-4      → Use sparingly
Tier 2 (Daily work):          claude-sonnet-4     → Primary model
Tier 3 (Background/Subagent): claude-haiku-3-5    → Subagent model
Tier 4 (Bulk/Heartbeat):      gemini-2.0-flash    → Heartbeat/cron
```

**Savings:** Routing background tasks to Haiku instead of Opus = **95% cost reduction** on those tasks.

## For AI Agents

Add to your heartbeat or cron:
```bash
bash /path/to/token-guard/scripts/token-guard.sh monitor
```

When budget is exceeded with hard limit enabled, the script automatically downgrades the primary model.

## Install

```bash
clawdhub install token-guard
# or: git clone https://github.com/jzOcb/token-guard
```

## Requirements

- `bash` 4+
- `python3`
- `curl`

## Related

- [config-guard](https://github.com/jzOcb/config-guard) — Config validation and auto-rollback
- [upgrade-guard](https://github.com/jzOcb/upgrade-guard) — Safe upgrades with snapshot and auto-rollback
- [agent-guardrails](https://github.com/jzOcb/agent-guardrails) — Code-level enforcement for AI agents

Files in this skill

  • SKILL.md3.2 KB
  • description_ar.txt307 B
  • description_cn.txt155 B
  • description_de.txt260 B
  • description_en.txt162 B
  • description_es.txt243 B
  • description_fr.txt273 B
  • description_it.txt226 B
  • description_ja.txt274 B
  • description_ko.txt247 B
  • description_ru.txt456 B
  • description_tw.txt155 B
  • stats.json65 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.