cost-tracking

Featured

Use when metering and capping AI or cloud app spend — tokens read from the response `usage` object, priced off a dated rate table, ledgered per user/tenant/feature, with alerts and a hard cap before the bill. NOT cash runway (that is `finance-ops`), NOT cost-per-unit margin (that is `unit-economics`), NOT booking the spend (that is `bookkeeping`).

AI & Automation 116 stars 9 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 92/100

Stars 20%
69
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Cost tracking You are building the money meter for an AI or cloud app: every model call gets a token count, a price, a ledger row, and a budget check — so a cap fires *before* the invoice, not when finance forwards it in a panic. Model-API spend roughly doubled from $3.5B to $8.4B between late 2024 and mid 2025 (firecrawl.dev best-llm-observability-tools, accessed 2026-06-02); the bill is now big enough to need a guardrail, not a spreadsheet at month-end. The chain you build, in order — each step feeds the next: 1. **Capture** — read tokens from the response, not from a pre-send guess. 2. **Price** — multiply tokens by a *versioned, dated* rate table. 3. **Ledger** — append one idempotent row per request, tagged for attribution. 4. **Budget** — roll the ledger up against a soft and a hard threshold. 5. **Guard** — alert, degrade, or refuse before the threshold becomes an invoice. The one rule that organizes everything: **bill against the response `usage` object. Anything you compute before the call is an estimate — good only for the pre-flight cap check, never for the ledger.** ## What this skill produces A checkable cost setup: a **pricing table** (each model row carries `effective_date` + `source`), an **append-only ledger** schema (idempotency key + attribution keys), and a **budget** with both a soft and a hard threshold. `scripts/verify.sh` lints those artifacts (last section). Prose alone is not a deliverable — emit the config. ## Capture: read `usage`, do not ...

Details

Author
ericrisco
Repository
ericrisco/rsc-harness
Created
3 months ago
Last Updated
2 days ago
Language
JavaScript
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category