Install
openclaw skills install llm-cost-trackerTrack, analyze, and optimize LLM API spending across providers (OpenAI, Anthropic, Google, DeepSeek, etc.). Use when the user asks about API costs, token usa...
openclaw skills install llm-cost-trackerMonitor and optimize your LLM API spending directly from your agent.
Run cost analysis:
python3 scripts/cost_tracker.py --summary
python3 scripts/cost_tracker.py --provider openai --period today
python3 scripts/cost_tracker.py --provider anthropic --period week
python3 scripts/cost_tracker.py --all --period month
python3 scripts/cost_tracker.py --set-budget 100 --period month --alert telegram
python3 scripts/cost_tracker.py --breakdown model --period week
python3 scripts/cost_tracker.py --optimize
This analyzes usage patterns and recommends:
| Provider | Method | Setup |
|---|---|---|
| OpenAI | Usage API | OPENAI_API_KEY env var |
| Anthropic | Usage API | ANTHROPIC_API_KEY env var |
| Google AI | Billing API | GOOGLE_API_KEY env var |
| DeepSeek | Usage API | DEEPSEEK_API_KEY env var |
Configure in ~/.openclaw/cost-tracker.json:
{
"budgets": {
"daily": 10,
"weekly": 50,
"monthly": 200
},
"alertChannels": ["telegram", "discord"],
"alertThresholds": [50, 75, 90, 100]
}
Alerts fire at each threshold percentage. At 100%, optionally pause non-critical agent tasks.
Reports generate as markdown tables suitable for any messaging surface:
Provider | Model | Tokens | Cost
------------|--------------------|-----------|---------
Anthropic | claude-opus-4-6 | 2.1M | $63.00
Anthropic | claude-sonnet-4-6 | 5.4M | $16.20
OpenAI | gpt-4o | 1.8M | $9.00
| TOTAL | | $88.20
See references/optimization-guide.md for detailed strategies on reducing API spend by 30-60% without sacrificing quality.