ai-receipt
Zero-dependency cryptographic audit receipts for AI agents & LLM pipelines.
Prove what prompt, model, tool call and output happened at time T — tamper-evident,
offline, < 1 ms, with no sensitive payload stored. Available on npm and PyPI, and
receipts made by one are byte-for-byte verifiable by the other.
npm i ai-receipt # JavaScript / TypeScript (Node >= 14)
pip install ai-receipt # Python >= 3.9
Quickstart (JS)
const { createReceipt, verifyChain, foldReceipts } = require('ai-receipt');
let prev = '';
const log = [];
for (const step of agentSteps) {
const r = createReceipt({
step: step.i, model: 'gpt-4o',
prompt: step.prompt, response: step.output, toolCalls: step.tools,
cost: step.microDollars, prevHash: prev, secretKey: process.env.AUDIT_KEY,
});
log.push(r); prev = r.hash;
}
verifyChain(log, process.env.AUDIT_KEY); // true — nothing was tampered
const summary = foldReceipts(log); // one 32-byte root for the whole trajectory
Quickstart (Python)
from ai_receipt import create_receipt, verify_chain, fold_receipts
prev, log = "", []
for s in agent_steps:
r = create_receipt(step=s.i, model="gpt-4o", prompt=s.prompt,
response=s.output, tool_calls=s.tools,
cost=s.micro_dollars, prev_hash=prev, secret_key=KEY)
log.append(r); prev = r["hash"]
assert verify_chain(log, secret_key=KEY)
summary = fold_receipts(log)
What it actually is (honest)
- A SHA-256 hash chain — the same tamper-evidence Git commits and blockchains use.
Change any past field and every later
hashbreaks. This is not zero-knowledge; it is a clean, standard, auditable primitive, which is exactly why you can trust it. - Payloads are stored as salted commitments, never in plaintext — so the receipt proves
what happened without leaking the prompt/PII. Reveal
(value, salt)later to open a commitment (selective disclosure). foldReceiptscollapses an N-step trajectory into one constant-size root.- Optional HMAC-SHA256 signing binds the log to a secret key.
Why it's useful
US/EU AI startups get asked by banks, auditors and the EU AI Act: "prove this AI output and
its audit log weren't tampered with." ai-receipt is a 2-line answer with zero dependencies
and no data leaving the process.
Open-core
- Free (MIT): everything above — receipts, chain/fold verification, selective disclosure, signing.
- Pro (commercial license key):
exportComplianceReport(..., proKey)emits SOC2 / EU-AI-Act formatted bundles with a signed header. The key check is a documented hook (_pro_key_valid) you wire to your license provider (e.g. LemonSqueezy) before selling — it does not phone home in this repo.
Tests
cd npm && node test/test.js # 11 tests incl. a cross-language hash fixture
cd pypi && python3 tests/test_receipt.py # 10 tests
The JS cross-language test asserts the exact hashes produced by the Python package, so the two implementations are provably interoperable.
License
MIT.
Metadata
Release files for ai-audit-receipt 0.1.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 |
|---|---|---|---|---|
| ai_audit_receipt-0.1.0.tar.gz | 7.1 kB | Without provenance | Details for ai_audit_receipt-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ai_audit_receipt-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ai_audit_receipt-0.1.0-py3-none-any.whl |
Total release size: 13.3 kB
Release files / ai_audit_receipt-0.1.0.tar.gz
| Download URL | ai_audit_receipt-0.1.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aab60aefd9fc861b9f276bd27d5f1e43bf4e3ee5e35b166de7d73f3bf8cc2710
|
|
BLAKE2b-256 checksum How to use checksums |
f0de6dc509bff1c78e2b37ab2bf599ec1e9fb63eddbe97a8b36067b29aeba7ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / ai_audit_receipt-0.1.0-py3-none-any.whl
| Download URL | ai_audit_receipt-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
975f11f20c75c283e0c9abc7ddbe2758bc2dcad8524d0f766265b011fe20d7d0
|
|
BLAKE2b-256 checksum How to use checksums |
bc5703f76980150c1b3faf9ef9b5a6870be72a6c8a642ac65d9c0fe2c9da49d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Security for ai-audit-receipt 0.1.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.