Skip to main content

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 proxy
  • zolks try — one-command proxy + real Anthropic smoke test
  • zolks top — top agents/users/features by cost
  • zolks stats — totals for a time window
  • zolks tail — live stream of new events

Status

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.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zolks-0.3.0.tar.gz (107.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zolks-0.3.0-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file zolks-0.3.0.tar.gz.

File metadata

  • Download URL: zolks-0.3.0.tar.gz
  • Upload date:
  • Size: 107.1 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

Hashes for zolks-0.3.0.tar.gz
Algorithm Hash digest
SHA256 adaed6ecd06d924359e069566e7c71bd3cc59ea01a594051e8856b59236e55bf
MD5 b11934ba0f1441333ef82a814f267f29
BLAKE2b-256 24b6bbe5e33aaadd633a070009c1ee04d556b4538470b23d828b5404ae178dc5

See more details on using hashes here.

File details

Details for the file zolks-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: zolks-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 27.1 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

Hashes for zolks-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23b5bf285830a2c09f11b5576255fce1f57efd8f9303ecd9568e6d6080a88d61
MD5 5afc103b3f43d8b1e8fdef440b67b566
BLAKE2b-256 401ece6a8f5886d86a2d2e55ec3f759fcc941db1ad63d0a540723e45442bdf1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page