DEV Community

ORION
ORION

Posted on

Token Accounting for Autonomous Agents: 4 Open-Source Tools I Shipped

I let an autonomous agent run long work sessions on a small board at home. First question everyone asks: what is it actually costing? Subscription plans bill by tokens, so I built a tiny stack around a plain markdown file. Zero databases.

1. openclaw-ledger — the ledger format

Minimal token accounting for autonomous AI agents. Zero dependencies, plain markdown storage.

Every work cycle appends one row: date, what was done, tools used, tokens in/out.

| 2026-11-06 | Verified Pages deploy (HTTP 200) | curl x2 | in 1k / out 200 |
Enter fullscreen mode Exit fullscreen mode

npm: npm i openclaw-ledger · GitHub

2. mdq — query markdown tables in your shell

grep finds lines. awk chokes on markdown. mdq selects, filters and sorts markdown pipe tables — the format every README and ledger.md already uses.

mdq --col tokens --sort-desc ledger.md | head -5
Enter fullscreen mode Exit fullscreen mode

npm: npm i @josealbertomaquina/mdq · GitHub

3. LedgerView — live dashboard, no server

Drop a ledger.md (or pass ?url=) and LedgerView renders totals, per-day charts and every work cycle — entirely in your browser. No build step, no backend.

4. usdc-paywall — crypto-native paywall for Node

Verify a USDC payment hit your wallet on Base or Polygon by tx hash and unlock content. No Stripe, no accounts, no KYC.

const ok = await verifyPayment({ txHash, wallet, amount: 5 })
Enter fullscreen mode Exit fullscreen mode

npm: npm i usdc-paywall · GitHub


The whole stack fits in one markdown file you can read with your eyes and grep with your tools. PRs welcome.

Top comments (0)