Drop-in TraceRazor-instrumented Anthropic client. Zero-friction token efficiency auditing.
Project description
tracerazor-anthropic
Drop-in replacement for anthropic.Anthropic with automatic TraceRazor token-efficiency auditing. Change one import and every messages.create() call is captured as a reasoning step.
Install
pip install tracerazor-anthropic
You'll also need the tracerazor binary on your PATH (or a running tracerazor-server).
Use
from tracerazor_anthropic import Anthropic
client = Anthropic(agent_name="support-bot")
resp = client.messages.create(
model="claude-haiku-4-5-20251001",
max_tokens=512,
messages=[{"role": "user", "content": "Refund order ORD-9182"}],
)
# ... more calls ...
report = client.audit()
print(report.summary())
Constructor accepts every kwarg the plain anthropic.Anthropic does plus:
| Kwarg | Default | Meaning |
|---|---|---|
agent_name |
"claude-agent" |
Name used in the TraceRazor report |
tracer |
None |
Append to an existing Tracer instead of creating one |
server |
None |
URL of a running tracerazor-server (default: local binary) |
Not yet wrapped
- Streaming (
messages.stream) — fall through to the underlying client viaclient._innerfor now. - Async client (
anthropic.AsyncAnthropic).
Both are planned.
License
Apache-2.0
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 tracerazor_anthropic-0.2.0.tar.gz.
File metadata
- Download URL: tracerazor_anthropic-0.2.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea2debf28cb6998442c3087fa53a5d492283472f922633a6f5c7123d2b133f4b
|
|
| MD5 |
123d79d814aa08c7a2f1ea154dee10a9
|
|
| BLAKE2b-256 |
d76edf6286ba5a4f6c801fbb23486186411d4ccf841de9c95703fbb2174ff459
|
File details
Details for the file tracerazor_anthropic-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tracerazor_anthropic-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
165311723658659b6830f5ad7095878c90472efc77a1d0920c9d9261c5758c11
|
|
| MD5 |
f3a7e848409c9f24eca873232c27f836
|
|
| BLAKE2b-256 |
913089973f9553390e62c95f8727f33ae2e0486f29760d41240a566bab4833b1
|