session-cost
БесплатноБез исполняемых скриптовНе проверенTrack and analyze your OpenClaw session costs. Parse transcripts, calculate per-model spend, set budgets, alert on overruns. Stop burning money blindly.
от modbender★ 21 звезда на GitHubОб этом скилле
Session Cost — Know What You Spend
Your agent burns tokens every turn. This skill tells you exactly how much.
Quick Cost Check
# Today's sessions
ls -la ~/.openclaw/agents/main/sessions/ | tail -5
# Parse costs from latest session
LATEST=$(ls -t ~/.openclaw/agents/main/sessions/*.jsonl 2>/dev/null | head -1)
[ -n "$LATEST" ] && python3 -c "
import json
total = 0
with open('$LATEST') as f:
for line in f:
entry = json.loads(line)
cost = entry.get('message',{}).get('usage',{}).get('cost',{}).get('total',0)
if cost: total += cost
print(f'Session cost: \${total:.4f}')
" || echo "No sessions found"
Daily Spend Summary
# All sessions today
python3 << 'PYEOF'
import json, glob, os
from datetime import date
today = date.today().isoformat()
total = 0
sessions = 0
for f in glob.glob(os.path.expanduser("~/.openclaw/agents/*/sessions/*.jsonl")):
if today in os.path.basename(f) or os.path.getmtime(f) > __import__('time').time() - 86400:
sessions += 1
with open(f) as fh:
for line in fh:
try:
cost = json.loads(line).get('message',{}).get('usage',{}).get('cost',{}).get('total',0)
if cost: total += cost
except: pass
print(f"Sessions today: {sessions}")
print(f"Total spend: ${total:.4f}")
print(f"Avg per session: ${total/max(sessions,1):.4f}")
PYEOF
Budget Alert
Add to your heartbeat:
## Cost Check (every 4 hours)
Run session cost check. If daily spend > $15, alert human.
# One-liner budget check
python3 -c "
import json,glob,os,time
t=0
for f in glob.glob(os.path.expanduser('~/.openclaw/agents/*/sessions/*.jsonl')):
if os.path.getmtime(f)>time.time()-86400:
for l in open(f):
try: t+=json.loads(l).get('message',{}).get('usage',{}).get('cost',{}).get('total',0)
except: pass
print(f'\${t:.2f} today')
if t>15: print('⚠️ OVER BUDGET')
"
Per-Model Breakdown
python3 << 'PYEOF'
import json, glob, os, time
from collections import defaultdict
models = defaultdict(float)
for f in glob.glob(os.path.expanduser("~/.openclaw/agents/*/sessions/*.jsonl")):
if os.path.getmtime(f) > time.time() - 86400:
with open(f) as fh:
for line in fh:
try:
msg = json.loads(line).get('message', {})
model = msg.get('model', 'unknown')
cost = msg.get('usage', {}).get('cost', {}).get('total', 0)
if cost: models[model] += cost
except: pass
for model, cost in sorted(models.items(), key=lambda x: -x[1]):
print(f" {model:50s} ${cost:.4f}")
PYEOF
Установить session-cost в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл session-cost?
Track and analyze your OpenClaw session costs. Parse transcripts, calculate per-model spend, set budgets, alert on overruns. Stop burning money blindly.
Как установить скилл session-cost?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл session-cost запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic