Cost observability for AI agents
Project description
Zolks
Local-first cost observability for AI tools. Open source, Python.
Two ways to capture AI API spend.
Fastest first run
pip install 'zolks[proxy]'
export ANTHROPIC_API_KEY=sk-ant-...
zolks try
Option 1 — The proxy (for CLI tools: Claude Code, Aider, Cursor, etc.)
pip install 'zolks[proxy]'
zolks proxy start
In another terminal:
export ANTHROPIC_BASE_URL=http://127.0.0.1:9191
claude-code "refactor this file"
aider
Then:
$ 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 new
Option 2 — The SDK (for Python apps you own)
pip install zolks
import 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.
How it works
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.
Commands
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
Status
0.2.0 — Anthropic only. Non-streaming calls capture full token data. Streaming calls are
captured as events but without token counts (coming in 0.3). OpenAI support coming.
Roadmap: OpenAI -> streaming token capture -> anomaly detection -> hosted team dashboard.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zolks-0.2.0.tar.gz.
File metadata
- Download URL: zolks-0.2.0.tar.gz
- Upload date:
- Size: 103.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b413d5b0ca1d857312b285af59e0d64816015387224363e1065aae25169ae591
|
|
| MD5 |
1e64395310708bdd81a99b61d7989b9c
|
|
| BLAKE2b-256 |
14788ecef1fb295860feae5875e63ac427fd6be14ea4ff5e6439270e983d9147
|
File details
Details for the file zolks-0.2.0-py3-none-any.whl.
File metadata
- Download URL: zolks-0.2.0-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ccb1f336bbea4c29976b1337009f96cd2e09658054cebc3066ac4ac337c3c46
|
|
| MD5 |
0c6faca6e73d52ddd1597a27d1385a4e
|
|
| BLAKE2b-256 |
d0ca9b197e01450f9e8eb202aa571c3a05a9d305714cb47822eb7a9ce50390a9
|