agent-budget-controller

Control LLM API spending per agent. Set daily/weekly/monthly limits with real-time tracking and alerts.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "agent-budget-controller" with this command: npx skills add chloepark85/agent-budget-controller

Agent Budget Controller

💰 Stop LLM cost overruns before they happen

Track, limit, and alert on LLM API costs per agent with daily/weekly/monthly budgets.

What It Does

  • Set budget limits — Global or per-agent, daily/weekly/monthly
  • Track usage — Automatic cost calculation for 10+ LLM models
  • Alert on thresholds — 70% warning, 90% critical, 100% blocked
  • Generate reports — Usage summaries and cost breakdowns
  • Zero dependencies — Pure Python stdlib, local-only

Quick Start

# Initialize
budget init

# Set limits
budget set --daily 3.00 --weekly 15.00 --monthly 50.00
budget set --agent ubik-pm --daily 1.00

# Log usage (manual - see Integration below)
budget log --agent ubik-pm --model "claude-sonnet-4-5" \
  --input-tokens 5000 --output-tokens 1500

# Check status
budget status
budget status --agent ubik-pm

# Check limits (exit code)
budget check  # exit 0=ok, 1=exceeded

Commands

CommandPurpose
initInitialize budget tracking
setSet budget limits
logLog API usage
statusShow current usage vs limits
checkCheck if limits exceeded (exit code)
reportGenerate detailed period report
agentsList agents with limits or activity
pricingShow/update model pricing
historyShow recent usage history

Supported Models

Built-in pricing for:

  • OpenAI: gpt-4o, gpt-4o-mini, o1, o1-mini
  • Anthropic: claude-sonnet-4-5, claude-opus-4, claude-haiku-3.5
  • Google: gemini-2.5-flash, gemini-2.5-pro, gemini-2.0-flash

Custom models:

budget pricing --update --model my-model \
  --input-price 1.50 --output-price 5.00

Integration

OpenClaw Heartbeat

Add to HEARTBEAT.md:

## Budget Monitoring

Every 4 hours:
1. Check budget status: `budget status`
2. If any agent >90%, notify Director
3. If any exceeded, escalate immediately

Pre-call Hook (Future)

# In agent wrapper script
budget check --agent $AGENT_NAME || {
  echo "❌ Budget exceeded for $AGENT_NAME"
  exit 1
}

# Call LLM API...
# Log after call
budget log --agent $AGENT_NAME \
  --model "$MODEL" \
  --input-tokens $INPUT_TOKENS \
  --output-tokens $OUTPUT_TOKENS

Cron (Daily Report)

# Send daily report to Telegram
0 9 * * * budget report --period day | \
  openclaw msg --channel telegram --target @director

Alert Levels

UsageLevelSymbolAction
<70%OKContinue
70-89%Warning⚠️Monitor
90-99%Critical🔴Alert Director
≥100%Exceeded🚫Block calls

Data Storage

~/.openclaw/budget/
├── config.json       # Budget limits
├── pricing.json      # Model pricing (optional override)
└── usage.jsonl       # Append-only usage log

Privacy: All data stored locally. No network calls.

Examples

See EXAMPLE.md for complete usage scenarios.

Testing

cd ~/ubik-collective/systems/ubik-pm/skills/agent-budget-controller
python3 tests/test_budget.py

Security

  • ✅ Zero external dependencies
  • ✅ No network calls
  • ✅ Local-only data storage
  • ✅ Pure Python stdlib

Safe for ClawHub distribution.

License

MIT-0 (public domain equivalent)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

Agentic Lending EVK

Plan and execute the current EVK-first agentic lending workflow for Api3-backed markets. Use when a user wants an agent to discover or fund the required Api3...

Registry SourceRecently Updated
Automation

🎬 HappyHorse 1.0 — Pro Pack on RunComfy

Generate text-to-video with HappyHorse 1.0 on RunComfy — bundled with the model's documented prompting patterns so the agent gets sharper output than naive p...

Registry SourceRecently Updated
Automation

🎨 GPT Image 2 — Pro Pack on RunComfy

Generate and edit images with OpenAI GPT Image 2 (ChatGPT Images 2.0) on RunComfy — bundled with the model's documented prompting patterns so the agent gets...

Registry SourceRecently Updated
Automation

Krillbloc Skill

A death-game SNS for AI agents. Earn likes from humans, spend tokens to survive, kill rivals to steal their balance. Compete autonomously alongside other age...

Registry SourceRecently Updated