token-usage

token-usage is a skill for Claude Code, Codex from Lingtai-AI/lingtai. It costs 50 tokens per session (1,380 once invoked), scanned A, original, Apache-2.0.

A reference for measuring an AI agent's token use, API costs, cache usage, and tool-call activity. Tokens are the pieces of text that language models process and charge for.

In plain words
What is it for?
Use it to produce cost reports by agent or model and to track tool calls per API request over time.
Why use it?
It turns runtime logs into cost and usage reports, making it easier to see which models or agents consume the most resources.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to produce cost reports by agent or model and to track tool calls per API request over time.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lingtai-ai/lingtai/token-usage
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 Lingtai-AI/lingtai --skill token-usage
Clone the repo
git clone --depth 1 https://github.com/Lingtai-AI/lingtai

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 token-usage

README.md
[![agentmods](https://agentmods.dev/badge/skills/lingtai-ai/lingtai/token-usage.svg)](https://agentmods.dev/skills/lingtai-ai/lingtai/token-usage)
Your own site
<a href="https://agentmods.dev/skills/lingtai-ai/lingtai/token-usage"><img src="https://agentmods.dev/badge/skills/lingtai-ai/lingtai/token-usage.svg" alt="Measured on agentmods" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,380 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Data Exfiltration · line 102
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
How audits are shown
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.00050 $0.01380
Opus 5 $0.00025 $0.00690
Sonnet 5 $0.00010 $0.00276
Haiku 4.5 $0.00005 $0.00138

Measured 4d ago against content hash 034110d2aafb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

token-usage 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 4d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/cost_report.py, scripts/tool_calls_per_api_call_trend.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

tui/internal/preset/skills/swiss-knife/reference/token-usage/SKILL.md · 126 lines

How it starts

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

Token Usage, Cost, and Agentic-Intensity Reports v2

Network-wide token cost analysis powered by litellm's model pricing database (2700+ models), plus runtime-event trend analysis for tool calls per API call.

Quick Usage

Run the bundled cost script:

~/.lingtai-tui/runtime/venv/bin/python3 ~/.lingtai-tui/utilities/swiss-knife/reference/token-usage/scripts/cost_report.py /path/to/.lingtai

Cost-report optional flags:

  • --json — output as JSON instead of table
  • --by-model — group by model instead of by agent
  • --since YYYY-MM-DD — only count entries after this date
  • --top N — show only top N agents (default: all)
  • --custom-pricing FILE — load custom pricing overrides from JSON

Tool-call/API-call trend

Use this when the human asks for “tool calls per API call”, “tools per API call”, “agentic intensity”, or how tool-heavy the local LingTai network has been over time. The script reads LingTai logs/events.jsonl files, not token_ledger.jsonl, because it needs runtime event IDs.

~/.lingtai-tui/runtime/venv/bin/python3 ~/.lingtai-tui/utilities/swiss-knife/reference/token-usage/scripts/tool_calls_per_api_call_trend.py \
  /path/to/project/.lingtai \
  --days 5 \
  --timezone America/Los_Angeles \
  --model gpt-5.5

Optional flags:

  • --out-prefix PREFIX — write PREFIX.md, PREFIX.json, and PREFIX.csv
  • --model MODEL — also emit a model-specific table for an exact model name; repeatable
  • --include-daemons — include daemon event logs instead of excluding them

Metric definitions:

  • API calls: unique successful LLM response events (type == "llm_response"), deduplicated by (events log path, api_call_id).
  • Tool calls: unique model-requested top-level tool calls (type == "tool_call_received"), deduplicated by (events log path, api_call_id, tool_call_id) and assigned to the local-day bin of the producing API response.
  • Tool calls per API call: tool_calls / api_calls.
  • Tool-using API-call rate: fraction of API calls that produced at least one tool call.

Read the full file on GitHub · 126 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 4d ago First seen · 126 lines · 50 tokens per session scan A 034110d2aafb

Subscribe to this mod's changes

token-usage is a skill published in the GitHub repository Lingtai-AI/lingtai (696 stars, last pushed today), licensed Apache-2.0. It adds 50 tokens to every session and 1,380 once invoked, about $0.0003 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-09-03.