Skip to content

aptratcn/agent-cost-guard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Agent Cost Guard ๐Ÿ’ฐ

Stop surprise AI bills. Track, budget, and optimize your agent spending.

๐Ÿ”ฅ GitHub Copilot just moved to usage-based billing (HN 545pts, Apr 2026). Cost awareness is no longer optional โ€” it's survival.

License: MIT Zero Dependencies Skill

The Pain

You're spending money. You don't know how much.

  • "How much did today's 6-hour coding session cost?"
  • "Why is my Claude bill $200 this month?"
  • "I'd use cheaper models for simple tasks but always forget"
  • "My team blew through the AI budget in week one"

GitHub Copilot โ†’ usage billing. free-claude-code 16Kโ˜… (+2,949/day). mattpocock/skills 30Kโ˜… (+5,645/day). The signal is clear: cost control is the #1 AI agent pain point in 2026.

The Solution

Agent Cost Guard gives you visibility and control:

๐Ÿ’ฐ This Session: $3.47
โ”œโ”€ Claude Opus 4: $2.81 (81%)
โ””โ”€ Claude Sonnet 4: $0.66 (19%)

๐Ÿ“Š Today: $7.23 / $10 daily budget
โš ๏ธ  Alert: 72% of budget used
๐Ÿ’ก Tip: 12 simple edits could use Haiku โ†’ Save $4.20

Quick Start

# Install
git clone https://github.com/aptratcn/agent-cost-guard.git ~/.agent-skills/

# Check status
cost-status

# Set daily budget ($10)
cost-budget --daily 10

# See history
cost-history --7d

# Get recommendations
cost-optimize

Features

Feature What it Does Why It Matters
Real-time tracking Estimates cost per task Know before the bill
Budget alerts Warn at 70%, stop at 100% Never overspend again
Model recommendations "Use Haiku for this" Save 60-80% on simple tasks
Cost reports By project, task, time Track where money goes

Example Session

$ cost-status

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ’ฐ Agent Cost Guard โ€” Session Summary        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Session Time: 2h 34m                         โ”‚
โ”‚ Tasks Completed: 23                          โ”‚
โ”‚                                              โ”‚
โ”‚ ๐Ÿ’ต Cost Breakdown:                           โ”‚
โ”‚ โ”œโ”€ Complex Debug (Opus 4): $4.12 (60%)      โ”‚
โ”‚ โ”œโ”€ Code Review (Sonnet): $1.87 (27%)        โ”‚
โ”‚ โ””โ”€ Quick Edits (Sonnet): $0.89 (13%)        โ”‚
โ”‚ Total: $6.88                                 โ”‚
โ”‚                                              โ”‚
โ”‚ ๐Ÿ“Š Budget Status:                            โ”‚
โ”‚ Daily: $6.88 / $10.00 (69%) โš ๏ธ              โ”‚
โ”‚ Monthly: $143.21 / $200.00 (72%)             โ”‚
โ”‚                                              โ”‚
โ”‚ ๐Ÿ’ก This Session Insights:                    โ”‚
โ”‚ โ€ข 8 quick edits could use Haiku (-$2.10)    โ”‚
โ”‚ โ€ข Batch 3 similar queries (-$0.80)          โ”‚
โ”‚ Potential savings: $2.90                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

How It Helps

Before Cost Guard

ๆœˆๆœซ็œ‹่ดฆๅ•๏ผš$347
ไฝ ๏ผš"๏ผŸ๏ผŸ๏ผŸๆ€Žไนˆ่Šฑไบ†่ฟ™ไนˆๅคš๏ผŸ"
Agents: ๐Ÿคทโ€โ™‚๏ธ

After Cost Guard

ๆฏๅคฉ๏ผš้ข„็ฎ— $10๏ผŒๅทฒ็”จ $7.23๏ผŒๆ”ถๅˆฐๆ้†’
ๅ‘จๆŠฅ๏ผšๆœฌๅ‘จ $48๏ผŒๅปบ่ฎฎ็œ $12๏ผˆ็”จ Haiku ๆ›ฟไปฃ็ฎ€ๅ•ไปปๅŠก๏ผ‰
ไฝ ๏ผšๅฟƒไธญๆœ‰ๆ•ฐ๏ผŒไธปๅŠจไผ˜ๅŒ–

Model Pricing Reference

Model Prompt ($/1M) Completion ($/1M) Best For
Claude Opus 4 $15 $75 Complex debug, architecture
Claude Sonnet 4 $3 $15 Most coding tasks
Claude Haiku 3.5 $0.80 $4 Simple edits, comments
GPT-4o $2.50 $10 General tasks
GPT-4o-mini $0.15 $0.60 Quick queries

Rule of thumb: Haiku for tasks you'd trust a junior dev, Opus for problems that need a principal engineer.

Why Not Other Solutions?

Solution Problem
Check billing dashboard After the fact, no prevention
Set API limits Hard cutoffs, no visibility
Use cheaper models manually Easy to forget
Agent Cost Guard Prevention + visibility + recommendations

Configuration

.cost-guard.json:

{
  "dailyBudget": 10,
  "monthlyBudget": 200,
  "warnThreshold": 70,
  "stopThreshold": 100,
  "defaultModel": "claude-sonnet-4",
  "cheapModel": "claude-haiku-3.5",
  "premiumModel": "claude-opus-4"
}

Real Savings

Typical developer using AI agents 4 hours/day:

  • Without optimization: ~$200/month
  • With Cost Guard recommendations: ~$120/month
  • Savings: $80/month = $960/year

Team scenario (10 devs): $9,600/year saved

Installation

# Option 1: Clone to skills directory
git clone https://github.com/aptratcn/agent-cost-guard.git ~/.agent-skills/

# Option 2: npx install (if using skills registry)
npx skills@latest add aptratcn/agent-cost-guard

# Option 3: Add to AGENTS.md
echo "- agent-cost-guard: ~/.agent-skills/agent-cost-guard" >> AGENTS.md

Related Projects

License

MIT


Stop guessing. Start tracking. ๐Ÿ“Š

About

๐Ÿ’ฐ Stop surprise AI bills. Track, budget, and optimize your agent spending โ€” addresses the #1 pain point proven by free-claude-code trending.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors