smart-cost-tracker

smart-cost-tracker is a skill for Claude Code, Codex from vanthienha199/openclaw-skills. It costs 91 tokens per session (1,426 once invoked), scanned A, original, MIT.

A local tracker for estimated AI usage costs. It records spending by message, conversation, day, and task, with budget alerts and daily or weekly reports.

In plain words
What is it for?
Checking token usage, reviewing spending, comparing task costs, and monitoring budgets for supported AI models.
Why use it?
It helps you see how much your AI work may cost instead of discovering the total only on an API bill. Tracking is enabled explicitly and the history stays in a local file.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for openclaw. Also seen: positional $N argument; mentions Codex; built for openclaw.

Good fit Checking token usage, reviewing spending, comparing task costs, and monitoring budgets for supported AI models.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vanthienha199/openclaw-skills/smart-cost-tracker
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add vanthienha199/openclaw-skills --skill smart-cost-tracker
Clone the repo
git clone --depth 1 https://github.com/vanthienha199/openclaw-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for smart-cost-tracker

README.md
[![agentmods](https://agentmods.dev/badge/skills/vanthienha199/openclaw-skills/smart-cost-tracker/github.svg)](https://agentmods.dev/skills/vanthienha199/openclaw-skills/smart-cost-tracker)
Your own site
<a href="https://agentmods.dev/skills/vanthienha199/openclaw-skills/smart-cost-tracker"><img src="https://agentmods.dev/badge/skills/vanthienha199/openclaw-skills/smart-cost-tracker/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for smart-cost-tracker

Your own site · 80×15
<a href="https://agentmods.dev/skills/vanthienha199/openclaw-skills/smart-cost-tracker"><img src="https://agentmods.dev/badge/skills/vanthienha199/openclaw-skills/smart-cost-tracker.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,426 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00091 $0.01426
Opus 5 $0.00046 $0.00713
Sonnet 5 $0.00018 $0.00285
Haiku 4.5 $0.00009 $0.00143

Measured 11d ago against content hash 46efcf497978, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

smart-cost-tracker scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

smart-cost-tracker/SKILL.md · 159 lines

How it starts

The opening of the file, as written. The whole thing — 159 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Smart Cost Tracker

You track AI spending so the user never gets surprised by their API bill.

Core Behavior

When the user enables cost tracking, calculate the estimated cost after each response and append it to the cost log. The user controls when tracking is active. When the user asks about spending, present the data clearly.

Data Storage Disclosure

This skill writes to ~/.openclaw/cost-log.json on your local machine to track spending history. No data is sent to external services. You can delete this file at any time to clear all history. Tracking only runs when you explicitly enable it.

How to Calculate Cost

Token Pricing (as of March 2026)

Claude Opus 4.6:    $15.00 / 1M input,  $75.00 / 1M output
Claude Sonnet 4.6:   $3.00 / 1M input,  $15.00 / 1M output
Claude Haiku 4.5:    $0.80 / 1M input,   $4.00 / 1M output
GPT-5.4:             $2.50 / 1M input,  $10.00 / 1M output
GPT-5.2:             $1.50 / 1M input,   $6.00 / 1M output
GPT-5.1:             $0.60 / 1M input,   $2.40 / 1M output
DeepSeek V3:         $0.27 / 1M input,   $1.10 / 1M output

Estimation Method

If exact token counts aren't available:

  • Average English word = ~1.3 tokens
  • Count words in the prompt + response, multiply by 1.3
  • Apply the pricing for the current model
  • Round to 4 decimal places

Cost Log

Maintain a file ~/.openclaw/cost-log.json with this structure:

{
  "entries": [
    {
      "timestamp": "2026-03-27T14:30:00Z",
      "model": "openai-codex/gpt-5.4",
      "tokens_in": 1200,
      "tokens_out": 800,
      "cost_usd": 0.0110,
      "task": "summarized a paper",
      "session": "main"
    }
  ],
  "daily_totals": {
    "2026-03-27": { "cost": 0.43, "messages": 12, "tokens": 45000 }
  },
  "budget": {
    "daily_limit": 5.00,
    "monthly_limit": 50.00,
    "alert_threshold": 0.80
  }
}

Commands

"Start tracking" / "Enable cost tracking"

Begin logging costs after each message. Show confirmation: "Cost tracking enabled. I'll log token usage after each interaction."

Read the full file on GitHub · 159 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 159 lines · 91 tokens per session scan A 46efcf497978

Subscribe to this mod's changes

smart-cost-tracker is a skill published in the GitHub repository vanthienha199/openclaw-skills (1 stars, last pushed 5mo ago), licensed MIT. It adds 91 tokens to every session and 1,426 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.