编程

Agent Cost Tracker

试用

Track LLM API spending per agent/session with budget alerts and CSV export

它能做什么

Track LLM API spending per agent/session with budget alerts and CSV export

技能文档

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

AlternativeWhy this skill is better
Cloud billing dashboardsPer-agent, per-session granularity you control locally.
Mental math on token countsPrice tables + estimation remove the guesswork.
Spreadsheet trackingCSV 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

相关技能

Track every token and dollar your OpenClaw agent spends, set budget walls that actually refuse calls, and replay runs on free local models. Local-first: all data stays on this machine. Use when the user asks about cost, spend, tokens, budgets, usage reports, or what the agent has been doing.

3 次安装

Record every tool call into agent-tracer (self-hosted FastAPI), then run regression testing (golden case → drift detection), attribute token costs by tool/model/agent, and surface recurring error root causes across sessions. Use when an agent must log its actions, verify behavior hasn't drifted, report spend, or debug repeated failures.

Audit and reduce AI agent runtime spend in dollars. Use for AI costs, agent spend, token waste, runtime attribution, detector coverage, and FinOps. Works with OpenClaw, Hermes, QM, Claude Code, Cursor, and generic event ingest.

2 星标

Build or modernize TypeScript CLIs for AI agents with @renxqoo/agent-cli-sdk. Use when a user wants a new command-line tool, an API or internal service wrapped as a CLI, or an existing agent-cli-sdk app extended with authentication, structured output, typed errors, pagination, pipes, Skill distribut

1 次安装

Tiny dependency-free TTL cache that skips a repeat LLM/API call entirely when the same input recurs. Fixes a common cost leak in agents that re-score/re-anal...

1 次安装

LLM gateway & AI completion API for agents — call frontier models (Claude, GPT, DeepSeek) across cheap/pro/ultra tiers from one endpoint, pay-per-call in USD...

1 次安装