Token导航 LogoToken导航TokenDH.com
效率敏感数据clawhub未标认证来源可访问clear审计通过

token-cost-estimator代币成本估算器

Agent Skill

token-cost-estimator 用于处理音频、语音、转写和声音素材相关任务,适合在 OpenClaw 中需要整理音频流程、转写内容或生成配音素材时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

15,240

周安装

635

GitHub Stars

1

下载量

5,080
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:token-cost-estimator(代币成本估算器)
来源仓库:https://github.com/npfaerber/token-cost-estimator
安装命令:
openclaw skills install token-cost-estimator
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install token-cost-estimator

简介

根据会话记录估算 OpenClaw 的 API 令牌成本。

  • 适合分析历史使用数据并计算实际支出。
  • 自动汇总所有代理会话以生成费用明细。
  • 安装前需确认是否会扫描日志文件或读取会话数据。
  • 建议核实数据来源权限后再启用。token-cost-estimator 属于效率类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

name
token-cost-estimator
description
Estimate API token costs from OpenClaw session transcripts. Analyzes all agent sessions to calculate what you'd pay on per-token pricing vs subscription plans. Use when asked about API costs, token usage, billing estimates, or comparing Max/Pro plans to pay-per-use.

Token Cost Estimator

Estimate real API costs from OpenClaw session transcript data.

How It Works

OpenClaw stores session transcripts as JSONL files in ~/.openclaw/agents/<agent>/sessions/*.jsonl. Each line is a turn with role, content, and sometimes usage data.

Estimation Script

Run this Python script to analyze all agents:

import json, glob, os

AGENTS_DIR = os.path.expanduser('~/.openclaw/agents')
# Pricing per million tokens (update as needed)
PRICING = {
    'opus': {'input': 15, 'output': 75, 'cache_read': 1.875},
    'sonnet': {'input': 3, 'output': 15, 'cache_read': 0.375},
}

agent_dirs = [d for d in os.listdir(AGENTS_DIR) if os.path.isdir(os.path.join(AGENTS_DIR, d))]
grand_in, grand_out = 0, 0

for agent in sorted(agent_dirs):
    sess_dir = os.path.join(AGENTS_DIR, agent, 'sessions')
    if not os.path.isdir(sess_dir):
        continue
    total_in, total_out, sessions = 0, 0, 0
    for f in glob.glob(os.path.join(sess_dir, '*.jsonl')):
        sessions += 1
        turns = []
        for line in open(f):
            try:
                obj = json.loads(line)
                msg = obj.get('message', {})
                if not isinstance(msg, dict): continue
                role = msg.get('role', '')
                raw = json.dumps(msg)
                turns.append((role, len(raw)))
            except: pass
        # Account for context re-sending
        cumulative = 0
        for role, chars in turns:
            if role in ('user', 'system', 'tool'):
                cumulative += chars
            elif role == 'assistant':
                total_in += cumulative // 4
                total_out += chars // 4
    print(f'{agent}: {sessions} sessions, ~{total_in:,} input, ~{total_out:,} output tokens')
    grand_in += total_in
    grand_out += total_out

print(f'\
Total input: ~{grand_in:,}, output: ~{grand_out:,}')
for tier, rates in PRICING.items():
    for cache_pct in [0.6, 0.9]:
        cached = int(grand_in * cache_pct)
        uncached = grand_in - cached
        cost = (uncached/1e6)*rates['input'] + (cached/1e6)*rates['cache_read'] + (grand_out/1e6)*rates['output']
        print(f'{tier} ({int(cache_pct*100)}% cache): ${cost:,.2f}')

Key Concepts

Context re-sending: Every API call sends the full conversation history as input. A 50-turn conversation re-sends all prior turns on each new message. This is the #1 cost driver.

Cache hits: OpenClaw caches prompt prefixes. Typical cache hit rates: 60-90%. Cache reads cost 87.5% less than fresh input.

What transcripts miss: System prompts, tool definitions, and internal retries aren't always logged. Real cost is typically 1.5-2x the transcript estimate.

Comparing Plans

PlanMonthly CostBest For
API (Opus)VariableHeavy agentic use (>$200/mo equivalent)
API (Sonnet)VariableMost agent tasks, 5x cheaper than Opus
Claude Max ($100)$100 flatLight-medium use via OAuth (if allowed)
Claude Max ($200)$200 flatHeavy use via OAuth (if allowed)

Break-even: If your estimated API cost exceeds your subscription price, the subscription saves money. Note: Anthropic has restricted OAuth token use in third-party tools.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

96.17%
按下载量换算4,885

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

未展示

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills