Track, budget, and alert on LLM API spending in real-time. Prevents runaway costs for AI agents, multi-user apps, and homelab automation.
After install, configure your daily budget:
text
set budget daily 5.00
Then register API calls via the tracker:
bash
# Log an LLM call
llm-cost-guard log --model gpt-4o --input-tokens 1500 --output-tokens 800 --user alice
# Check current spend
llm-cost-guard status
# View full report
llm-cost-guard report
CommandDescriptionllm-cost-guard statusCurrent spend vs budgetllm-cost-guard reportFull breakdown by user/model/dayllm-cost-guard set-limit daily <USD>Set daily spend limitllm-cost-guard set-limit user <key> <USD>Set per-user limitllm-cost-guard resetReset counters (e.g., start of new period)llm-cost-guard watchLive tail of all LLM callsllm-cost-guard logRecord a manual LLM usage entry
json
{
"dailyCostLimit": 5.00,
"monthlyCostLimit": 50.00,
"perUserDailyCostLimit": 1.00,
"defaultModel": "gpt-4o-mini",
"alertAt": 0.8,
"alertChannel": "whatsapp",
"dataPath": "~/.openclaw/workspace/llm-cost-guard-data.json"
}
ProviderModelsOpenAIgpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, o1, o1-mini, o3-miniAnthropicclaude-3-5-sonnet, claude-3-5-haiku, claude-3-opus, claude-sonnet-4, claude-haiku-4Groqllama-3.3-70b, llama-3.1-8b, mixtral-8x7b, gemma2-9bOllamaLocal models (free, $0 tracked)
The skill auto-installs a daily cron job to:
bash
# Manually add cron
openclaw cron add "0 8 * * *" "llm-cost-guard report --send-to whatsapp"
You run multiple OpenClaw agents with different API budgets. This skill tracks each agent's spend independently and warns you before the bill arrives.
Users get a free daily quota (e.g., $0.50/day). This skill enforces it, returning a friendly 429 when exceeded.
Run llm-cost-guard report --period month to see your full monthly AI spend breakdown by model and user.
All data stored locally at ~/.openclaw/workspace/llm-cost-guard-data.json. No external services. No telemetry.
Every dependency is a potential VirusTotal flag, a supply chain risk, and a maintenance burden. This skill uses only Node.js stdlib and OpenClaw's built-in tools.