Know what your
agents cost.
Meter. Budget. Control.
Open-source reverse proxy that gives you real-time cost attribution, budget enforcement, and financial observability for AI agents — without changing a single line of code.
How it works
One env var. Full observability. Zero code changes.
See everything. In real time.
Built-in web dashboard — no Grafana, no Datadog, no extra tools needed.
| Name | Requests | Input Tokens | Output Tokens | Cost (USD) |
|---|---|---|---|---|
| claude-sonnet-4.6 | 256 | 1,050,620 | 364,298 | $8.62 |
| claude-opus-4.6 | 131 | 601,292 | 189,435 | $7.74 |
| gpt-4.1 | 229 | 887,851 | 292,850 | $4.12 |
| gpt-4o | 158 | 567,736 | 186,563 | $3.28 |
| gemini-2.5-pro | 75 | 256,163 | 90,016 | $1.22 |
| claude-haiku-4.5 | 146 | 571,041 | 186,675 | $1.20 |
| mistral-large-latest | 66 | 302,135 | 87,260 | $1.13 |
| o3-mini | 80 | 292,429 | 97,161 | $0.749 |
| Agent | Model | Cost |
|---|---|---|
| research-agent | claude-opus-4.6 | $0.382 |
| code-generator | claude-opus-4.6 | $0.375 |
| code-generator | claude-opus-4.6 | $0.369 |
| code-generator | claude-opus-4.6 | $0.329 |
| code-generator | claude-opus-4.6 | $0.329 |
Everything you need to
control AI costs
From real-time tracking to budget enforcement — all included, all free.
Zero Code Changes
Set one env var and you're done. Works with any OpenAI or Anthropic SDK.
Real-Time Cost Tracking
Every request metered, every token counted, every dollar attributed. 83+ models with up-to-date pricing.
Budget Enforcement
Daily and monthly limits per API key, per agent, or per tenant. Soft warnings, hard blocks.
Pre-Flight Estimation
Calculates worst-case cost before forwarding to the API. Rejects requests that would exceed your budget.
Agent Session Tracking
Group multi-call agent runs into sessions. See exactly what each execution costs.
Loop Detection
Automatically detects and stops runaway agents stuck in infinite loops. Zero configuration needed.
Ghost Agent Detection
Finds agents that are still running but haven't made a request in a while. Prevents silent cost bleed.
15 LLM Providers
OpenAI, Anthropic, Azure, Gemini, Groq, Mistral, DeepSeek, and 8 more — all behind one endpoint.
Embedded Dashboard
Real-time web UI for cost visibility. No external tools needed.
Prometheus + Grafana
OpenTelemetry metrics, /metrics endpoint, pre-built Grafana dashboard template.
Multi-Tenancy
Isolate costs by team or org. Tenant-scoped budgets and dashboard filtering.
Alerting
Slack and webhook notifications for budget warnings, loop detection, and anomalies.
Rate Limiting
Per-key request throttling with sliding window counters.
Admin API
Runtime budget rule management without restarts. API key blocklist with glob patterns.
MCP Tool Metering
Track costs of MCP (Model Context Protocol) tool calls alongside LLM usage.
CSV/JSON Export
Export cost data for accounting, compliance, or external analysis.
Circuit Breaker
Automatic upstream failure protection. Don't burn money on failed requests.
15 Providers. 83+ Models.
One Proxy.
Route to any provider through a single endpoint. Built-in pricing for every model.
Up and Running in 60 Seconds
No databases. No configuration files. No code changes. Just install and go.
Install
One command. No dependencies.
# Homebrew
$ brew install wdz-dev/tap/agentledger
# Or download the binary
$ curl -sSL https://github.com/WDZ-Dev/agent-ledger/releases/latest/download/agentledger_$(uname -s)_$(uname -m).tar.gz | tar xz
# Or Docker
$ docker run --rm -p 8787:8787 ghcr.io/wdz-dev/agent-ledger:latest Start the proxy
Single binary. Zero config needed.
$ agentledger serve
▸ Proxy listening on :8787
▸ Dashboard at http://localhost:8787/ui
▸ Metrics at http://localhost:8787/metrics Point your agents
One env var. Zero code changes.
# OpenAI SDK
export OPENAI_BASE_URL=http://localhost:8787/v1
# Anthropic SDK
export ANTHROPIC_BASE_URL=http://localhost:8787/anthropic
# Any other provider
export GROQ_BASE_URL=http://localhost:8787/groq/openai See what you're spending
Per-agent cost breakdown. Real-time.
$ agentledger costs --last 24h --by agent
AGENT REQUESTS INPUT TOKENS OUTPUT TOKENS COST (USD)
code-reviewer 47 125,340 42,100 $1.23
pr-summarizer 12 8,200 3,400 $0.08
data-pipeline 156 890,000 245,000 $8.41
TOTAL 215 1,023,540 290,500 $9.72 Set budgets
Guardrails before it gets expensive.
# agentledger.yaml
budget:
default:
daily_limit_usd: 50.00
monthly_limit_usd: 500.00
soft_limit_pct: 0.8 # warn at 80%
action: block # block when exceeded
rules:
- api_key_pattern: "sk-proj-dev-*"
daily_limit_usd: 5.00
- tenant_id: "team-ml"
daily_limit_usd: 200.00 No pricing page needed.
Everything is free. Forever. No enterprise paywall.
All features included. No usage limits.
Apache 2.0 open source.
AgentLedger vs the Competition
| Feature | AgentLedger | Competitors |
|---|---|---|
| Architecture | Go single binary, sub-10ms overhead | Python, documented memory leaks |
| Cost model | Per-agent-execution tracking | Per-key/user/team only |
| Loop detection | Built-in, zero-config | Not available |
| Ghost agent detection | Built-in | Not available |
| Pre-flight estimation | Rejects before API call | Post-hoc only |
| Budget enforcement | Free, included |
$$$
Enterprise $$$ |
| Audit logs | Free, included |
$$$
Enterprise $$$ |
| SSO | Free, included |
$$$
Enterprise $$$ |
| Setup | brew install + one env var | Python + pip + database server |
| Dependencies | Zero (embedded SQLite) | PostgreSQL required, Redis recommended |
"Why not just check the OpenAI dashboard?"
The OpenAI dashboard shows total org spend. It doesn't tell you:
- Which agent execution caused the $47 spike at 3am
- That your coding assistant is stuck in a loop burning $12/minute
- That the intern's test script has been running for 6 hours
- How much each team is spending vs their budget
AgentLedger answers all of these. In real-time. For every provider.
"Why not an existing proxy?"
Existing LLM proxies are mature. They're also:
- Slow — Python + async overhead, documented memory leaks
- Heavy — require PostgreSQL, Redis recommended
- Paywalled — budgets, audit logs, SSO locked behind Enterprise ($$$)
- Not agent-aware — track per key, not per agent execution
AgentLedger is a single Go binary. Install it. Set one env var. Done.
Built for engineers who hate
surprise cloud bills.
AgentLedger is free, open-source, and ships as a single binary with zero dependencies. Star us on GitHub and take control of your AI costs.
We built what we needed. You probably need it too.