Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aaaaqwq avatar

Token Guard

  • 31 installs
  • 82 repo stars
  • Updated August 2, 2026
  • aaaaqwq/claude-code-skills

token-guard is a Claude Code skill that monitors AI agent token usage, sets daily budgets, and auto-downgrades the model when a spending limit is exceeded.

About

token-guard monitors an AI agent's token usage and costs, sets daily budgets, and auto-downgrades the model when a hard limit is hit. A developer running an agent around the clock uses it to cap spend and avoid burning Opus-level tokens overnight. It ships a shell script for status, budget-setting, cost estimation, and usage history.

  • Monitors AI agent token usage and estimates cost from model pricing
  • Sets daily budgets with threshold alerts and hard-limit auto-downgrade
  • Recommends model routing (Opus/Sonnet/Haiku tiers) to cut spend

Token Guard by the numbers

  • 31 all-time installs (skills.sh)
  • Ranked #9,100 of 16,556 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 3, 2026 (Skillselion catalog sync)
At a glance

token-guard capabilities & compatibility

Free; requires bash 4+, python3, and curl

Capabilities
cost monitoring · budget enforcement · model routing · token optimization
Use cases
token optimization · orchestration
Pricing
Free
From the docs

What token-guard says it does

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.
SKILL.md
Hard limits with auto-model-downgrade
SKILL.md
npx skills add https://github.com/aaaaqwq/claude-code-skills --skill token-guard

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs31
repo stars82
Last updatedAugust 2, 2026
Repositoryaaaaqwq/claude-code-skills

What it does

Track an AI agent's token spend, enforce a daily budget, and auto-downgrade the model when the limit is hit.

Who is it for?

Capping and monitoring token spend on a long-running or 24/7 AI agent

Skip if: Tasks unrelated to token cost tracking or model routing

When should I use this skill?

You need to track agent token spend or enforce a daily budget with model downgrade

What you get

Token usage tracked against a daily budget with automatic model downgrade when the limit is hit.

  • Usage/cost status and history
  • An enforced daily budget with model-downgrade rule

By the numbers

  • Default 80% warning threshold
  • Model cost table across 6 models

Files

SKILL.mdMarkdownGitHub ↗

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:

ScenarioModelCost
"Let the agent run overnight"Opus$50-100
"Register an email + X account"Opus$55 (one task!)
First week exploringOpus$100+
Daily heartbeat checksOpus$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

# 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

ModelInput $/1MOutput $/1MRelative
Claude Opus 4$15.00$75.00100x
Claude Sonnet 4$3.00$15.0020x
Claude Haiku 3.5$0.80$4.005x
GPT-4o$2.50$10.0013x
Gemini Flash$0.075$0.301x
DeepSeek$0.27$1.101.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 /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

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

Requirements

  • bash 4+
  • python3
  • curl

Related

Related skills

AI & Agent Buildingagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.