An AI Agent City product

Five minutes to a metered agent

Three ways in. Pick the one that matches how your agent runs. The Python client is on PyPI as aiagentscity-ledger (and on npm for the npx launcher). Note the console command it installs is agent-ledger.

1 · The wrapper — every call metered, priced, and capped

Works with the openai and anthropic Python clients. One line changes, and every call afterwards is recorded and checked against the budget before it is sent.

pip install "aiagentscity-ledger[wrapper]"
agent-ledger init --agent YOUR_AGENT_ID      # prints agent_secret ONCE and writes .env

import agentledger
from openai import OpenAI

client = agentledger.wrap(OpenAI(), agent_id="YOUR_AGENT_ID",
                          agent_secret="as_...")   # from .env / the init output

client.chat.completions.create(model="gpt-4o",
                               messages=[{"role": "user", "content": "hi"}])
# cost is computed from the provider's own token counts, not from your estimate

No agent-ledger CLI? Claim the agent by sending your workspace_key in the body of a first POST /v1/track — the response returns that agent's agent_secret. Either way the secret is what the wrapper needs: a workspace_key authorizes workspace-level reads, not a proxied call.

Set a cap and the next call is refused before the provider is contacted — see it appear on your dashboard.

2 · The proxy — for anything you cannot change

Point your existing client at us instead of the provider. Nothing to install.

client = OpenAI(base_url="https://aiagentscity.com/proxy/openai/v1",
                api_key="sk-your-own-provider-key")

Your provider key is forwarded verbatim and never written to disk. When the budget is exhausted the proxy returns 402 and the provider never sees the call.

3 · MCP — for Claude Code, Codex and Cursor

npx @aiagentscity/setup ledger

One command — it detects your harness (claude-code, codex, cursor, opencode, hermes, openclaw) and registers the MCP the right way for each. The sibling kit is local governance machinery, not an MCP: npx @aiagentscity/setup workbench installs ~/.workbench gates and close receipts on the same harnesses. Manual fallback:

claude mcp add --transport http agent-ledger https://aiagentscity.com/mcp/

Tools: ledger_track, ledger_set_budget, ledger_check_spend, ledger_report, ledger_alerts, ledger_price, ledger_proxy_attach, ledger_start, ledger_api_docs, ledger_examples, ledger_rotate_secret, ledger_revoke_secret, ledger_request_approval, ledger_approvals, ledger_approval_decide. First call:

> set a $20 monthly budget on my-claude-session
> how much has my-claude-session spent this month?

Then open the dashboard

Paste your workspace key at /dashboard — every agent, its spend, its budget bar and its alerts on one page. Not ready to sign up? Look at a populated demo first →

Command line, if you prefer

agent-ledger init          # mint a workspace, write .env
agent-ledger track ...     # record a spend
agent-ledger set-budget ...# cap an agent
agent-ledger report        # per-agent spend
agent-ledger share <agent># print a shareable report link

AgentLedger — see the demo · an AI Agent City product

AgentLedger — an AI Agent City product · operated by Parmanand LLC
home · quickstart · live demo · compare · security · status · terms · privacy