agentleFS
QuixiAIQuixiAI/agi-memory/skills/installed/cost-report/SKILL.md

cost-report

Skill617 starsChanged 10 months agoMITView on GitHub

Query and report on API usage costs across LLM, embedding, and tool providers

We split this skill into the rules it gives an agent

9 rules. 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the user asks "how much have I spent" or "show me my usage"

    line 18
  2. Distinctive:

    When evaluating whether to switch models or providers based on cost efficiency

    line 20
  3. Distinctive:

    After a heavy ingestion or research session to assess the cost impact

    line 22
  4. Distinctive:

    Determine the time window: Default to the current billing period (calendar month) unless the user specifies a range.

    line 26
  5. Very specific:

    Query the ledger: Use query_usage with the appropriate date range.

    line 27
  6. Distinctive:

    Compare to budget: If a budget threshold is configured, compare current spend and projection against it.

    line 38
  7. Distinctive:

    Always show actual numbers, not vague descriptions.

    line 43
  8. Distinctive:

    When projecting monthly cost, note that it is an extrapolation and actual spend may vary.

    line 45
  9. Distinctive:

    If the usage ledger is empty or the query returns no data, say so plainly rather than reporting zeros that could be misleading.

    line 46

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Usage Cost Reporting

Query the API usage ledger and produce clear, actionable cost reports broken down by provider, model, and time period.

When to Use

  • When the user asks "how much have I spent" or "show me my usage"
  • During heartbeats to check if spending is approaching a configured budget threshold
  • When evaluating whether to switch models or providers based on cost efficiency
  • As part of a daily or weekly briefing that includes operational metrics
  • After a heavy ingestion or research session to assess the cost impact

Step-by-Step Methodology

  1. Determine the time window: Default to the current billing period (calendar month) unless the user specifies a range. Common windows: today, this week, this month, last 30 days, custom range.
  2. Query the ledger: Use query_usage with the appropriate date range. The tool returns rows from the api_usage table with provider, model, token counts (input/output), and computed cost.
  3. Aggregate by dimension: Break down the raw data into useful summaries:
    • By provider: Total cost per provider (OpenAI, Anthropic, local inference, etc.)
    • By model: Cost per model to identify which models consume the most budget
    • By category: Separate LLM inference costs from embedding costs from tool API costs
    • By day: Daily trend to spot spikes or patterns
  4. Compute key metrics: Calculate:
    • Total spend for the period
    • Average daily cost
    • Cost per conversation (if trackable)
    • Projected monthly cost at current burn rate
  5. Compare to budget: If a budget threshold is configured, compare current spend and projection against it. Flag if on track to exceed.
  6. Present the report: Format as a clean table or summary. Lead with the headline number (total spend), then break down by the most useful dimension.

Quality Guidelines

  • Always show actual numbers, not vague descriptions. "You have spent $4.32 this month" is useful; "you have moderate usage" is not.
  • Round costs to two decimal places for readability.
  • When projecting monthly cost, note that it is an extrapolation and actual spend may vary.
  • If the usage ledger is empty or the query returns no data, say so plainly rather than reporting zeros that could be misleading.
  • In heartbeat context, only generate a cost report if spend is approaching a threshold or if a goal explicitly asks for cost monitoring. Do not waste energy on routine cost checks every heartbeat.
  • Protect cost data as operational metadata. Do not expose it to external services.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.