Local-first cost observability for AI tools. Open source, Python.
Two ways to capture AI API spend.
pip install 'zolks[proxy]'
export ANTHROPIC_API_KEY=sk-ant-...
zolks trypip install 'zolks[proxy]'
zolks proxy startIn another terminal:
export ANTHROPIC_BASE_URL=http://127.0.0.1:9191
claude-code "refactor this file"
aiderThen:
$ zolks top
agent runs tokens cost trend
claude-code 14 284K $2.18 new
aider 3 42K $0.31 new
python-sdk 21 119K $0.94 newpip install zolksimport zolks
zolks.init()
from anthropic import Anthropic
client = Anthropic()
with zolks.tag(agent="refund-bot", user_id="user_123"):
client.messages.create(model="claude-opus-4-7", messages=[...])The same zolks top command shows SDK and proxy events side by side.
The proxy is a local HTTP server that forwards Anthropic API calls and captures tokens,
latency, and cost per request. Tools are identified by User-Agent. All data stays on your
machine in ~/.zolks/events.db.
The SDK monkey-patches anthropic.Anthropic and tags calls with whatever zolks.tag(...)
context is active.
zolks proxy start— run the local proxyzolks try— one-command proxy + real Anthropic smoke testzolks top— top agents/users/features by costzolks stats— totals for a time windowzolks tail— live stream of new events
0.3.0 — First release with a stable schema. Captures Anthropic API calls through either
the local proxy or the Python SDK. Local SQLite storage with exact-precision cost tracking
(nanodollars). Cloud sync planned for 0.4.
Streaming calls are captured as events without token counts (coming in 0.4). OpenAI support coming.
Roadmap: OpenAI -> streaming token capture -> anomaly detection -> hosted team dashboard.
MIT