Skip to main content

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 via assistant_response/v1 schema.
  • 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.

Metadata

Release files for openai-ledgerproof 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openai-ledgerproof 0.1.1
File Size Uploaded Provenance
openai_ledgerproof-0.1.1.tar.gz 17.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for openai-ledgerproof 0.1.1
File Interpreter ABI Platform
openai_ledgerproof-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.8 kB

Release files / openai_ledgerproof-0.1.1.tar.gz

Download URL openai_ledgerproof-0.1.1.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1254b040446079e933448390216feaec433a9dac5c6ddd97912d7601b6a55c64
BLAKE2b-256 checksum
How to use checksums
ef009f152e099aa8b89b1e1fe70c160d031df0c8d31c2cc757b2d507e84dd01b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / openai_ledgerproof-0.1.1-py3-none-any.whl

Download URL openai_ledgerproof-0.1.1-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91ee9e8704f73706b53ef09b28fe403080cf838075f6f0efcdb52ea5cbd627ea
BLAKE2b-256 checksum
How to use checksums
63a91bbf04236f0a7db4a9c47fbebd6c92b6af6ae5274aad4af821e48fb3d652
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for openai-ledgerproof 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page