Quickstart
Two lines. Every Anthropic and OpenAI call tracked automatically. No other changes required.
Install
Add two lines to your startup file
Open the file that starts your agent — main.py, app.py, wherever your workflow boots. Add these before any model calls:
If you're already tracking input_tokens + output_tokens manually on each call, remove that code. apeiros.instrument() replaces it entirely.
How is this different from tracking tokens yourself?
If you're already logging token counts per call, you're tracking volume. Apeiros adds three things on top:
1. Per-customer margin visibility
Raw token counts tell you what you spent. Apeiros tells you who caused it and whether that customer is profitable against your plan price.
2. Automatic anomaly detection
Your token log shows a number. Apeiros tells you why it's high — retry loops, context bloat, tool spikes — at the call level, automatically.
3. One line replaces your manual tracking
apeiros.instrument() patches the client globally at startup. Remove the per-call tracking you wrote yourself and replace it with one line.
What gets detected automatically
Per-customer cost attribution
"How do I know I can trust this?"
What instrument() does: patches the Anthropic/OpenAI client in memory, reads token counts from the response object after each call, stores them in a local Python dict.
What it does not do: send data anywhere, store API keys or prompts, make any network requests, write to disk, or persist anything after the process ends.
If you want full control, vendor it — copy the files directly into your repo and skip PyPI entirely: