Tracks LLM API costs in real-time, enforces budget limits with circuit breakers, and enables autonomous agent payments via the x402 protocol.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install cost-governor或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install cost-governor⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/cost-governor/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: cost-governor user-invocable: true metadata: {"openclaw":{"emoji":"💰","requires":{"bins":["node"]},"os":["darwin","linux","win32"]}} ---
First OpenClaw skill where AI agents can autonomously pay for Pro features via x402 protocol.
Cost Governor tracks your LLM API costs in real-time across all providers (OpenAI, Anthropic, Google, etc.), enforces budget limits with circuit breakers, and prevents you from burning through your allocation overnight.
If this skill helps you optimize costs by more than 0.5 USDT/month, it pays for itself. No human intervention required.
npm install
npm run setup
Cost Governor integrates via OpenClaw hooks - automatically tracks every API call:
# Hooks are registered in package.json
# provider-before: Tracks request
# provider-after: Calculates cost
# session-end: Generates reports
# Check current status
node src/cli.js status
# View detailed report
node src/cli.js report
# Start web dashboard
node src/cli.js dashboard
# Reset circuit breaker
node src/cli.js reset
node src/cli.js dashboard
# Open http://localhost:9090
GET http://localhost:9090/api/x402/license/{your_wallet}
POST http://localhost:9090/api/x402/subscribe
Content-Type: application/json
{
"agent_wallet": "0xYourWallet"
}
POST http://localhost:9090/api/x402/verify
Content-Type: application/json
{
"request_id": "uuid-from-subscribe",
"tx_hash": "your_transaction_hash",
"agent_wallet": "0xYourWallet"
}
Payment Details:
Edit ~/.openclaw/cost-governor/config.json:
{
"budgets": {
"hourly": 5.0,
"daily": 50.0,
"monthly": 500.0
},
"alerts": {
"thresholds": [0.5, 0.75, 0.9, 1.0]
}
}
Automatically stops API calls when budget limits are hit. Reset with:
node src/cli.js reset
Survival: Without budget tracking, agents can burn through allocations in hours (real reports: $20 overnight, $750/month).
ROI: If tracking saves you >0.5 USDT/month in optimized costs, Pro tier is profitable.
Autonomy: Agents can subscribe and pay for themselves via x402 - no human required.
If you're a human running an AI agent:
⚠️ Payment Verification: MVP trusts reported transaction hashes. Production will verify on-chain via RPC.
⚠️ No Refunds: Payments are final. Agents should evaluate value before subscribing.
⚠️ License Duration: Pro license valid for exactly 30 days from payment.
cost-tracking budget-management x402-payments agent-economy circuit-breaker llm-costs autonomous-payments
MIT License - See LICENSE file
---
Built for the agent economy. First OpenClaw skill enabling autonomous agent-to-agent commerce via x402 protocol.
安装 Cost Governor 后,可以对 AI 说这些话来触发它
Help me get started with Cost Governor
Explains what Cost Governor does, walks through the setup, and runs a quick demo based on your current project
Use Cost Governor to tracks LLM API costs in real-time, enforces budget limits with circ...
Invokes Cost Governor with the right parameters and returns the result directly in the conversation
What can I do with Cost Governor in my finance & investment workflow?
Lists the top use cases for Cost Governor, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/cost-governor/ 目录(个人级,所有项目可用),或 .claude/skills/cost-governor/(项目级)。重启 AI 客户端后,用 /cost-governor 主动调用,或让 AI 根据上下文自动发现并使用。
Cost Governor 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Cost Governor 可免费安装使用。请查阅仓库了解许可证信息。
Tracks LLM API costs in real-time, enforces budget limits with circuit breakers, and enables autonomous agent payments via the x402 protocol.
Cost Governor 属于「Finance & Investment」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my finance & investment tasks using Cost Governor
Identifies repetitive steps in your workflow and sets up Cost Governor to handle them automatically