← BACK
botzy-tokenizer · PyPI

Tokenizer

botzy-tokenizer

Per-call token usage + Rupee-cost (₹) intelligence for the Anthropic API — live on PyPI.

pip install botzy-tokenizer
WHAT IT DOES

“The moat is observed per-key data — not a counter, but a full audit trail: which source called which model, how many tokens were spent, what those tokens cost in ₹, and exactly how much you saved (or left on the table) through prompt caching.”

FEATURES
Everything you need. Nothing you don't.
01Drop-in create() / async_create() — replaces client.messages.create(...) one-for-one.
02Best-effort usage logging — writes one SQLite row per call, NEVER raises into your code.
03₹-cost intelligence — per source × model × token-type, priced from a bundled rates file.
04Cache savings tracking — ₹ actually saved by cache reads + ₹ missed by eligible-but-uncached calls.
05Cost-report CLI — PER-MODEL, SAVED-BY-CACHE, MISSED-SAVINGS, and TOTAL sections (1h / 24h / 1w / 1m windows).
06Model-lock gate (opt-in) — lock haiku / sonnet / opus families; off by default, no surprises.
07Nothing hardcoded (R13) — db, rates, lockfile, home all config / env-driven; edit the rates yaml, not code.
KEY FUNCTIONS
Five surfaces. One package.
create() / async_create()
Drop-in replacement for client.messages.create(...) — one-for-one, logs every call without ever raising into your code.
cost-report CLI
PER-MODEL · SAVED-BY-CACHE · MISSED-SAVINGS · TOTAL — across 1h / 24h / 1w / 1m windows.
cache-savings tracking
₹ actually saved by cache reads, and ₹ missed on eligible-but-uncached calls — the full caching ledger.
model-lock gate
Opt-in lock on haiku / sonnet / opus families — off by default, no surprise spend.
config / env-driven (R13)
Nothing hardcoded — db path, INR rates, the model lockfile and home are all config/env-driven; tune the rates yaml, never the code.