tracerazor-openai
Drop-in replacement for openai.OpenAI with automatic TraceRazor token-efficiency auditing. Zero friction — change one import line and every chat.completions.create() call is captured as a reasoning step.
Install
pip install tracerazor-openai
You'll also need the tracerazor binary on your PATH (or a running tracerazor-server).
Use
from tracerazor_openai import OpenAI
client = OpenAI(agent_name="support-bot")
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Refund order ORD-9182"}],
)
# ... more calls ...
report = client.audit()
print(report.summary())
Constructor accepts every kwarg the plain openai.OpenAI does plus:
| Kwarg | Default | Meaning |
|---|---|---|
agent_name |
"openai-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) |
How it works
The wrapper uses composition — every attribute of the underlying openai.OpenAI client is proxied via __getattr__. Only chat.completions.create() is intercepted to record the call as a reasoning step. If instrumentation fails for any reason (parsing, network, etc.) the original response is still returned unchanged.
License
Apache-2.0
Metadata
Release files for tracerazor-openai 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tracerazor_openai-0.2.0.tar.gz | 3.6 kB | Without provenance | Details for tracerazor_openai-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tracerazor_openai-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for tracerazor_openai-0.2.0-py3-none-any.whl |
Total release size: 7.7 kB
Release files / tracerazor_openai-0.2.0.tar.gz
| Download URL | tracerazor_openai-0.2.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3670165458f1378d5942ff89fae605225e4b98207545f8aa99af62d1b18d38dd
|
|
BLAKE2b-256 checksum How to use checksums |
e1121657f5c572f3dfbfef433d0779aac3243bb092988bfb3e1d3f33b8b6f237
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.6
|
Release files / tracerazor_openai-0.2.0-py3-none-any.whl
| Download URL | tracerazor_openai-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bdff203d878ca45a93db8aa54311092cdbad5d41fc83996c55332f9f037bddb4
|
|
BLAKE2b-256 checksum How to use checksums |
f36ff1f5d04a40ec83e3a412b675ce029ebf791d8df57967d0e018a92264a7ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.6
|
Security for tracerazor-openai 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.