# Send Token Cost Estimator to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "token-cost-estimator",
    "name": "Token Cost Estimator",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/npfaerber/token-cost-estimator",
    "canonicalUrl": "https://clawhub.ai/npfaerber/token-cost-estimator",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/token-cost-estimator",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=token-cost-estimator",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "token-cost-estimator",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-10T01:45:36.233Z",
      "expiresAt": "2026-05-17T01:45:36.233Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=token-cost-estimator",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=token-cost-estimator",
        "contentDisposition": "attachment; filename=\"token-cost-estimator-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "token-cost-estimator"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/token-cost-estimator"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/token-cost-estimator",
    "downloadUrl": "https://openagent3.xyz/downloads/token-cost-estimator",
    "agentUrl": "https://openagent3.xyz/skills/token-cost-estimator/agent",
    "manifestUrl": "https://openagent3.xyz/skills/token-cost-estimator/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/token-cost-estimator/agent.md"
  }
}
```
## Documentation

### 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'\\nTotal 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 ForAPI (Opus)VariableHeavy agentic use (>$200/mo equivalent)API (Sonnet)VariableMost agent tasks, 5x cheaper than OpusClaude 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.
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: npfaerber
- Version: 1.0.1
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-10T01:45:36.233Z
- Expires at: 2026-05-17T01:45:36.233Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/token-cost-estimator)
- [Send to Agent page](https://openagent3.xyz/skills/token-cost-estimator/agent)
- [JSON manifest](https://openagent3.xyz/skills/token-cost-estimator/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/token-cost-estimator/agent.md)
- [Download page](https://openagent3.xyz/downloads/token-cost-estimator)