360 Secure SkillHub
360 安全技能中心

Agent Cost Tracker

这是一个自包含的 Python 命令行工具,按 agent/会话估算和统计 GPT/Claude/Gemini 等模型的 LLM API 花费,支持内置价格表比对、按 agent 设置预算告警,并从运行日志汇总后导出 CSV 供财务使用。不调用任何 API,全部计算在本地完成。

itspremkumar
itspremkumar
热度 15.00
最近更新 2026-07-13 17:56:37
分类:数据依赖:代码执行 / 读写文件应用场景:财务 / 数据处理 / 报告撰写 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add agent-cost-tracker
Metadata
name
agent-cost-tracker
version
2.0.0
description
Track LLM API spending per agent/session with budget alerts and CSV export
tags
["cost","tracking","llm","budget","cli","finance","python","open-source","agent","automation","MIT"]

LLM Cost & Token Tracker

Estimate and tally LLM API spending per agent/session with budget alerts and CSV export.

Keywords: cost, tracking, llm, budget, cli, finance, python, open-source, agent, automation, MIT

Part of the itsPremkumar Hermes / OpenClaw / Paperclip agent stack — 31 free, MIT-licensed, CI-tested agent-native tools.

What it does

Token spend balloons silently across agents and models with no per-agent accountability. LLM Cost & Token Tracker solves this: Estimate and tally LLM API spending per agent/session with budget alerts and CSV export.

Best for: Founders, finops, and agent operators running multi-agent LLM workloads on GPT/Claude/Gemini.

Features

  • Estimate cost before sending a prompt
  • Tally spend from agent run logs
  • Set per-agent budget alerts
  • Export a CSV for finance
  • Compare model pricing at a glance

Install

# Requires Python 3.8+. No pip install needed.
curl -O https://raw.githubusercontent.com/itsPremkumar/agent-cost-tracker/main/agent_cost_tracker.py
# Or copy the file anywhere — it's self-contained.

Quick start

python agent_cost_tracker.py self-test     # prove it works end-to-end
python agent_cost_tracker.py tally --help   # tally subcommand
python agent_cost_tracker.py estimate --help   # estimate subcommand

Use cases

  1. Estimate cost before sending a prompt
  2. Tally spend from agent run logs
  3. Set per-agent budget alerts
  4. Export a CSV for finance
  5. Compare model pricing at a glance

Why choose this over alternatives

Alternative Why this skill is better
Cloud billing dashboards Per-agent, per-session granularity you control locally.
Mental math on token counts Price tables + estimation remove the guesswork.
Spreadsheet tracking CSV export drops straight into your existing finance stack.

FAQ (SEO / AEO)

Q: Which models are supported?
A: gpt-* (OpenAI), claude-* (Anthropic), gemini-* (Google) with built-in price tables.

Q: Where does it get tokens?
A: From agent run logs (tally) or from --prompt/--completion estimates.

Q: Does it call the API?
A: No. It is an estimator/tally from logs and inputs; no network calls.

Q: Can I export to CSV?
A: Yes — CSV export is built in for spreadsheets and BI tools.

Geo / local reach

Built and maintained by @itsPremkumar (Chennai, India · serving developers worldwide). Free for individuals and teams everywhere. Documentation in English; tool output is locale-neutral.

CI integration

# .github/workflows/verify.yml
name: Verify
on: [push]
jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Self-test agent-cost-tracker
        run: python agent_cost_tracker.py self-test

Support

Free + MIT-0 (free, modifiable, no attribution required). Sponsor if useful:

⭐ Star on GitHub