Skip to main content

metrecept-sdk (Python)

Thin helper so the official OpenAI SDK becomes a one-line base_url swap for Metrecept, which returns a signed Ed25519 receipt for every call.

Install (editable)

cd sdks/python
pip install -e ".[openai]"

Publish to PyPI

Every real call needs a Metrecept API key; the default base URL is https://api.metrecept.co.uk/v1.

cd sdks/python
python -m build
twine upload dist/*

Usage

from metrecept_sdk import openai_client, LOCAL_BASE_URL, DEFAULT_BASE_URL

client = openai_client("sk-at-dev", base_url=LOCAL_BASE_URL)
# After cutover:
# client = openai_client("sk-at-...", base_url=DEFAULT_BASE_URL)

Every receipted response carries X-Metrecept-Verify, a public link that checks the signature in the reader's browser — no account. Append it to whatever the agent already produced (PR body, ticket, email):

from metrecept_sdk import receipt_trailer

body = body + "\n\n" + receipt_trailer(response.headers)
# -> "Receipt: https://metrecept.co.uk/verify#eyJ..."

It also accepts the JSON of GET /v1/sessions/{id}. Returns "" when there is nothing to link. The JWS rides the URL fragment, so it never reaches a server log.

A streamed MISS cannot carry its receipt in a header (the headers leave before the provider has finished), so it rides as the last data: chunk before [DONE], with empty choices. Read it out of the stream you kept:

from metrecept_sdk import receipt_from_sse_lines, verify_url

jws = receipt_from_sse_lines(captured.splitlines())   # "" when the stream did not finish
link = verify_url(jws) if jws else ""

Metadata

Release files for metrecept-sdk 0.2.0

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

Source distribution (sdist)

Source distribution for metrecept-sdk 0.2.0
File Size Uploaded Provenance Actions
metrecept_sdk-0.2.0.tar.gz 13.8 kB Without provenance Details for metrecept_sdk-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for metrecept-sdk 0.2.0
File Interpreter ABI Platform Actions
metrecept_sdk-0.2.0-py3-none-any.whl Python 3 none any Details for metrecept_sdk-0.2.0-py3-none-any.whl

Total release size: 29.7 kB

Release files / metrecept_sdk-0.2.0.tar.gz

Download URL metrecept_sdk-0.2.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e8f5645c416b4b65b42f49614beb85576975a8af4b23cf5034f1c035b4c9e741
BLAKE2b-256 checksum
How to use checksums
3ce5c5fcb188eacd8f929055bee21af8143391e330d308ce062a03c683b52a8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / metrecept_sdk-0.2.0-py3-none-any.whl

Download URL metrecept_sdk-0.2.0-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a40ad78630a476e6023d9a185dda17e31d9b6542a02d5193ed5627e2e02689cc
BLAKE2b-256 checksum
How to use checksums
3ea168b4b1e846c80df11cfda962699281d13e88ff4b20dced9ce9531392be16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for metrecept-sdk 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.

Release history Release notifications | RSS feed

This release

0.2.0 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