Cost tracking for AI agents

Know what your
agent spends.

CostMeter sits between your AI agent and API providers. Every token counted, every dollar tracked, every budget enforced. One command to install, zero config to start.

# Install + auto-configure (detects OpenClaw, Claude Code)
curl -fsSL https://costmeter.io/install.sh | sh

Free to use. No account required. Runs on your machine.

The problem

AI agents make API calls you don't see. A coding session burns through tokens. A research task hits three providers. A scheduled job runs while you sleep.

By the time you check the dashboard, the bill is already there. CostMeter gives you visibility and control before things get expensive.

Works with your stack

CostMeter auto-detects your tools and configures itself. No YAML editing. No env var juggling.

🦞

OpenClaw

Auto-imports all provider keys and patches config

🤖

Claude Code

Detects credentials and patches settings.json

🔌

Any Agent

Works with any tool that supports ANTHROPIC_BASE_URL or OPENAI_BASE_URL

Key features

📊

Real-time cost tracking

Every API call logged with provider, model, tokens in/out, latency, and dollar cost. Query by day, week, or month. Group by provider, service, model, tool, or project.

🛡️

Budget enforcement

Set hard limits per provider, service, or project. Soft warnings at 80%, hard blocks at 100%. Atomic check-and-reserve prevents race conditions in concurrent agents.

Rate limit visibility

Captures rate limit headers from Anthropic and OpenAI responses. See remaining requests and tokens in real time. Know when you're about to hit the wall.

🔐

OAuth passthrough

Works with subscription plans (Claude Pro/Max) without touching auth. Your OAuth tokens pass through untouched. CostMeter tracks tokens and rate limits, not dollars.

🔔

Alerts where you are

Budget warnings via webhook, Slack, Discord, or piped through OpenClaw to WhatsApp/Telegram. With cooldown dedup so you don't get spammed.

🔄

Self-updating

Runs as a system service (systemd/launchd). Survives reboots, auto-restarts on crash. Weekly auto-update with SHA-256 checksum verification.

Built for agents

Not a dashboard you check after the fact. CostMeter is a proxy that sits in the hot path. SSE streaming passes through chunk-by-chunk with zero buffering. Cost is injected as an SSE comment so your agent can read it in real time.

# Agent → CostMeter → Anthropic (streaming)
data: {"type":"content_block_delta","delta":{"text":"Hello"}}
: costmeter_cost=0.000034
data: {"type":"content_block_delta","delta":{"text":" world"}}
: costmeter_cost=0.000067
data: {"type":"message_stop"}

Supported providers

OpenAIAnthropicGoogle (8 services)DeepSeekMistralGroqPerplexityElevenLabs

+ any OpenAI-compatible endpoint via format: openai — Together, Fireworks, Ollama, etc.

Everything from the CLI

# What did I spend today?
$ costmeter spend --by provider

PROVIDER     COST       REQUESTS
anthropic   (sub)      47
openai      $2.34     142
google      $0.85     170

TOTAL       $3.19 + subscription

# How much headroom do I have?
$ costmeter limits

anthropic (claude-sonnet-4)
  Requests:   950 / 1000 remaining (95%)
  Tokens:     480K / 500K remaining (96%)

# Watch live
$ costmeter tail

# Full diagnostics
$ costmeter doctor

Your data stays yours

CostMeter runs on your machine. API keys never leave your system. Prompts and responses are not stored — only metadata: provider, model, token counts, cost, latency. The SQLite database lives at ~/.costmeter/costmeter.db.

Local-firstNo cloud dependencyNo prompt logging

Stop guessing.
Start tracking.

One command. Auto-detects your setup. Running in 30 seconds.

curl -fsSL https://costmeter.io/install.sh | sh
Read the docs →View on GitHub →