LedgerProof adapter for the OpenAI Python SDK — emits Article 50 transparency receipts as a side channel.
Project description
ledgerproof-openai
LedgerProof adapter for the official OpenAI Python SDK. Emits signed EU AI Act Article 50 transparency receipts as a side channel — your OpenAI response is returned unmodified.
pip install ledgerproof-openai
5-minute quickstart
from openai_ledgerproof import LedgerProofOpenAI
client = LedgerProofOpenAI(
deployer_id="urn:eu:deployer:acme-bank-de",
regulatory_context={"schema": "chatbot_session/v1", "jurisdiction": "EU"},
)
resp = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
# A signed receipt has been emitted to the configured emitter
# (stdout LogEmitter by default).
Three integration patterns
1. Client wrapper (recommended)
from openai_ledgerproof import LedgerProofOpenAI, LedgerProofAsyncOpenAI
client = LedgerProofOpenAI(deployer_id="urn:eu:deployer:acme")
async_client = LedgerProofAsyncOpenAI(deployer_id="urn:eu:deployer:acme")
Works with both non-streaming (stream=False) and streaming
(stream=True) chat completions. Streaming uses incremental SHA-256
over each chunk (constraint C6).
2. Decorator
from openai import OpenAI
from openai_ledgerproof import lpr_track
client = OpenAI()
@lpr_track(deployer_id="urn:eu:deployer:acme")
def ask(question: str):
return client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": question}],
)
3. Manual emission
from openai import OpenAI
from openai_ledgerproof import emit_receipt
client = OpenAI()
resp = client.chat.completions.create(...)
emit_receipt(resp, deployer_id="urn:eu:deployer:acme")
Custom emitters
from openai_ledgerproof import LedgerProofOpenAI, WebhookEmitter, QueueEmitter
client = LedgerProofOpenAI(
deployer_id="urn:eu:deployer:acme",
emitter=WebhookEmitter(url="https://receipts.acme.example/ingest"),
)
Scope and discipline (C1–C8)
This adapter implements the LedgerProof protocol with the following discipline:
- C1 — No regulator endorsement. This package is not endorsed by the European Commission, EU AI Office, or any national supervisory authority. It does not provide an Article 40 presumption of conformity.
- C4 — Offline verification. Receipts are verifiable offline against the published protocol public key and Bitcoin OP_RETURN anchor. The adapter does not phone home.
- C6 — Stream-aware signing. Streaming completions are hashed incrementally so the receipt covers the full reconstructed text.
- C7 — Side-channel only. This adapter never modifies the OpenAI response. Receipts emit through a separate emitter (log/webhook/queue).
What this adapter does NOT do
- Does not address Article 9 (risk management), Article 10 (data governance), Article 13 (transparency to deployers), Article 15 (accuracy/robustness/cybersecurity), or Article 72 (post-market monitoring).
- Does not claim Article 40 presumption of conformity.
- Does not claim OpenAI Inc. endorsement.
- Provides the Article 50 evidence layer only for users of the direct OpenAI SDK.
Roadmap
- v0.2: OpenAI Assistants API (
client.beta.threads.runs) coverage viaassistant_response/v1schema. - v0.2: Pluggable HSM-backed signer (AWS KMS, GCP KMS, Azure Key Vault, YubiHSM2).
- v0.3: Built-in Merkle batcher with periodic flush to anchoring service.
License
Apache 2.0. See LICENSE.
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 openai_ledgerproof-0.1.1.tar.gz.
File metadata
- Download URL: openai_ledgerproof-0.1.1.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1254b040446079e933448390216feaec433a9dac5c6ddd97912d7601b6a55c64
|
|
| MD5 |
cb23da8a412f5dad0c18943f7b511a83
|
|
| BLAKE2b-256 |
ef009f152e099aa8b89b1e1fe70c160d031df0c8d31c2cc757b2d507e84dd01b
|
File details
Details for the file openai_ledgerproof-0.1.1-py3-none-any.whl.
File metadata
- Download URL: openai_ledgerproof-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91ee9e8704f73706b53ef09b28fe403080cf838075f6f0efcdb52ea5cbd627ea
|
|
| MD5 |
5b3c7c31a756423175e67e6e9f4ca3df
|
|
| BLAKE2b-256 |
63a91bbf04236f0a7db4a9c47fbebd6c92b6af6ae5274aad4af821e48fb3d652
|