跳到正文
TakoAPI
返回技能列表

session-cost

由 khaney64 提供

Coding Agents & IDEs
1.7k下载量由 clawskills.sh 提供
1星标
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Analyze OpenClaw session logs to report token usage, costs, and performance metrics grouped by model.

描述

该技能的功能

Reads OpenClaw session .jsonl log files and reports token usage, costs, and performance metrics grouped by agent and model. Supports filtering by agent name, provider, and time range. Output formats include plain text, JSON, compact table, and a Discord-friendly summary.

Aggregates costs and token counts across multiple agents and models in one command without needing to check each provider dashboard separately.

何时使用

  • Checking total API spend across all agents for the past week
  • Comparing token costs between Anthropic and OpenAI providers
  • Generating a daily usage digest formatted for a Discord bot
  • Auditing how much a specific agent consumed during a debugging session
  • Exporting session cost data as JSON for further processing

示例工作流

输入

User asks: how much did I spend on Anthropic models in the last 24 hours?

智能体
  1. 1

    Run node scripts/session-cost.js --provider anthropic --offset 24h

  2. 2

    Scan ~/.openclaw/agents/ for all agent directories

  3. 3

    Read .jsonl session files matching the time and provider filters

  4. 4

    Group results by agent and model, compute token and cost totals

输出

A breakdown of sessions, token counts, and dollar costs per agent and model for Anthropic usage in the past 24 hours

安装

clawhub install khaney64/session-cost

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接