ah
7 min read

AI Agent Costs Are a Black Box, So I Built AgentMeter

AgentMeter tracks what your AI coding sessions actually cost — Claude Code, Cursor, and CI agents — with per-engineer attribution and one unified dashboard.

AgentMeter

Software engineering is undergoing a fundamental shift. We're not talking about another framework or cloud service—this is about how we write code itself. AI coding agents are moving from experimental toys to daily infrastructure. Claude Code, Cursor, GitHub Copilot, Codex—engineers are running these all day, every day, on their local machines and in CI pipelines. They're auto-implementing issues, reviewing PRs, maintaining documentation, and running in scheduled workflows.

The trajectory is clear: AI coding is becoming a standard part of the job. Just like we automated testing and deployment, we're now automating implementation and review. The infrastructure is mature, the results are measurable. But there's one glaring problem nobody wants to talk about.

The Part Where We Pretend Money Doesn't Exist

Here's what bothers me about the current state of AI-powered development: every session costs money, but good luck figuring out how much. A single feature implementation can spawn a long Claude Code session—explore the codebase, write the code, run the tests, fix the issues, iterate. Each turn burns tokens. Thousands of them. Then a CI agent picks it up for review. More tokens. More cost.

But where exactly do you go to see what that costs?

Check Anthropic's console? You'll find aggregate daily API spend with zero attribution to which engineer, which project, or which task drove it. It's like getting a credit card statement that just says "You spent $847 on stuff." Cursor doesn't expose billing per session. The CI agent runs are a complete black box. Claude Code and Codex don't surface token counts anywhere obvious.

You can't answer basic questions like "How much did implementing issue #47 cost?" or "Which engineer is spending the most on AI?" or "Why did our AI bill double last month?" You're flying completely blind. For individual developers paying Anthropic out of pocket, this is annoying. For teams with 20+ engineers running agents all day on their machines and in CI, it's a legitimate operational problem.

The irony is thick. We've built sophisticated tooling to track every millisecond of API latency, every byte of memory usage, every cent of AWS spend. But when it comes to AI agents—the most expensive part of modern development workflows—we just shrug and hope for the best.

Building the Receipt Layer

I got tired of guessing, so I built AgentMeter. It gives your whole team a single dashboard of AI spend—across every local Claude Code and Cursor session, and every CI agent run—with per-engineer attribution.

The CLI: local sessions, no proxying

The primary way AgentMeter works is a lightweight CLI that each engineer installs once:

npx @agentmeter/cli init
npx @agentmeter/cli install   # background service, syncs every 5 min

That's it. The CLI scans session data that Claude Code and Cursor already write to your machine—JSONL conversation logs for Claude Code, the local SQLite database for Cursor—extracts token counts and costs, and syncs them to your dashboard. No proxying. No shared API keys. No config changes to your existing tools. Each engineer uses their own personal API key so every session is attributed to them automatically.

AgentMeter runs feed — every agent run with cost, status, model, and duration

Every session lands in one feed: cost, model, duration, status, and who ran it. You can see local Claude Code sessions and CI runs side by side. Filter by contributor, project, source, or engine.

AgentMeter runs feed filtered by contributor

Drill into any session

Open any run to see exactly what it did and what it cost—full token breakdown including input, output, cache reads, and cache writes.

AgentMeter run detail — full token breakdown with input, output, cache read, and cache write counts

Team attribution

One view of what every engineer is spending on AI coding. Spot outliers, track coverage, and see who hasn't connected yet—without chasing anyone.

AgentMeter contributors — per-engineer AI spend, session counts, and connection status

Click any engineer to see their spend over time and every session they've run.

AgentMeter contributor detail — individual spend over time and full session history

CI agent runs: the GitHub Action

For agents running in CI—Claude Code Action, Codex, GitHub Agentic Workflows—there's a companion GitHub Action. Drop it in after your existing agent step:

steps:
  - uses: anthropics/claude-code-action@v1
    id: agent
    with:
      anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
      prompt: "Implement the feature described in this issue"

  - uses: agentmeter/agentmeter-action@main
    if: always()
    with:
      api_key: ${{ secrets.AGENTMETER_API_KEY }}
      status: ${{ steps.agent.outcome }}
      model: claude-sonnet-4-5
      input_tokens: ${{ steps.agent.outputs.input_tokens }}
      output_tokens: ${{ steps.agent.outputs.output_tokens }}
      cache_read_tokens: ${{ steps.agent.outputs.cache_read_tokens }}
      cache_write_tokens: ${{ steps.agent.outputs.cache_write_tokens }}

The action never fails your workflow—all errors surface as warnings. It automatically posts a cost summary comment on the PR or issue, so the cost context lives right where developers are working.

AgentMeter cost summary comment posted on a GitHub PR

For GitHub Agentic Workflows, which run in their own workflows, there's a companion mode that hooks into the workflow_run event:

# .github/workflows/agentmeter.yml
on:
  workflow_run:
    workflows:
      - "Agent: Implement Issue"
      - "Agent: Code Review"
    types: [completed]

jobs:
  track:
    runs-on: ubuntu-latest
    permissions:
      actions: read
      issues: write
      pull-requests: write
    steps:
      - uses: agentmeter/agentmeter-action@main
        with:
          api_key: ${{ secrets.AGENTMETER_API_KEY }}
          engine: claude
          model: claude-sonnet-4-5
          workflow_run_id: ${{ github.event.workflow_run.id }}

Local sessions and CI runs flow into the same dashboard. No stitching spreadsheets together.

Why Visibility Matters

Once you start seeing the numbers, patterns emerge quickly. That innocent-looking "review this PR" session? It might be consuming 50,000 input tokens because the agent included the entire codebase context. Those retry loops when tests fail? Each one costs as much as the original implementation. Cache tokens can cut costs by 90% for repeated operations, but only if you know they're being used.

AgentMeter adds ratings so you can score run quality against cost—find out if the priciest sessions are actually delivering.

AgentMeter ratings — score run quality against cost to find out if expensive sessions deliver

And trends let you see spend broken down by engineer, project, AI engine, and source over time.

AgentMeter trends — AI spend over time, broken down by engineer, source, and project

This isn't about penny-pinching. It's about making informed decisions. Maybe those automated PR reviews are worth $2 each because they catch real issues. Maybe they're not. Maybe certain types of tasks cost 10x more than others. Maybe your prompts are including unnecessary context. Without data, you're just guessing.

For teams where every engineer runs Claude Code and Cursor all day—this adds up fast. A 20-person engineering team can easily burn through thousands of dollars per month in AI coding costs. That's real money that needs real accountability.

Where This Is All Heading

AI coding agents are becoming standard parts of software development. When engineers run Claude Code on every feature and agents fire in CI on every PR, cost accountability isn't optional. It's the same reason we have billing dashboards for AWS, metrics for API usage, and alerts for resource consumption.

The difference is that AI agent costs are variable in ways that traditional infrastructure isn't. A complex feature might cost $20 to implement. A simple bug fix might cost $0.50. Without visibility, you can't optimize, you can't budget, and you can't make rational decisions about where to deploy these powerful but expensive tools.

AgentMeter is the receipt layer for agentic development. Install the CLI, add the GitHub Action to your CI workflows, and start seeing what your agents actually cost—per engineer, per project, per run. Because in a world where AI is writing increasingly more of our code, understanding the economics isn't optional—it's table stakes.

Install free at agentmeter.app — one command to get started.