Skip to main content

idemcore (Python SDK)

Python client for the Idemcore API. Every chat answer comes with a signed receipt, and this package can check that receipt on your own machine.

  • Chat completions (plain or streaming) that return the answer text and its receipt id.
  • Fetch a receipt and its public token log.
  • Verify receipts locally: Ed25519 signature (L1), token-log chain (L2), and your prompt / answer against the receipt's salted commitments (disclosure).
  • Server-side checks: remote verify, replay on an independent build (L3), audit export.
  • Sync and asyncio clients. Python 3.9+. Dependencies: idemcore-verify and cryptography.

Decoding is greedy: temperature is fixed at 0 (and n at 1). Sending any other temperature raises InvalidRequestError before a request is made.

Install

pip install idemcore

Get an API key

  1. Sign in to the console at https://console.idemcore.net/#/login (the public preview is free, with preview limits).
  2. Create an API key. It starts with ick_ and is shown only once.
  3. Export it:
export IDEMCORE_API_KEY="ick_..."

The client reads IDEMCORE_API_KEY (and, optionally, IDEMCORE_BASE_URL, default https://api.idemcore.net). You can also pass Idemcore(api_key=...).

Quickstart

from idemcore import Idemcore

client = Idemcore()
model = client.models()[0]["id"]   # pass a model id explicitly

r = client.chat("Name the three primary colours.", model=model, max_tokens=64)
print(r.text)
print(r.receipt_id)          # rcpt_...

# Verify on this machine: signature, token-log chain, and that the receipt
# commits to exactly this prompt and this answer.
result = client.verify_local(r)
print(result.ok)             # True
for name, level in result.levels.items():
    print(name, level.ok, level.errors)

r.receipt is the full signed receipt, r.salt the base64url salt of a hash_only receipt (the default privacy mode). Anyone with the salt and the text can check the commitments, so keep the salt with the conversation.

Streaming

with client.chat_stream("Write a haiku about receipts.", model=model) as stream:
    for chunk in stream:
        print(chunk.delta, end="", flush=True)

print()
print(stream.result.receipt_id)   # the receipt arrives with the last chunk

Async

import asyncio
from idemcore import AsyncIdemcore

async def main():
    client = AsyncIdemcore()
    model = (await client.models())[0]["id"]
    r = await client.chat("Hello", model=model)
    print(r.text, r.receipt_id)

asyncio.run(main())

Receipts, logs and server-side checks

receipt = client.get_receipt("rcpt_...")             # GET /v1/receipts/{id}
log = client.get_receipt_log("rcpt_...")             # GET /v1/receipts/{id}/log
print(log.log_format)                                # idemcore-log/r1-public

client.verify_remote(r.receipt, messages=r.messages, salt=r.salt,
                     output_token_ids=r.output_token_ids)   # POST /v1/receipts/verify
client.replay_result(r)                              # POST /v1/receipts/replay (L3)
lines = client.audit_export("2026-10-01", "2026-10-31")     # POST /v1/audit/export (NDJSON lines)
client.models()                                      # GET /v1/models
client.keys()                                        # GET /v1/keys (signing keys, JWKS)

Offline verification without the client

from idemcore.verify import verify_receipt

res = verify_receipt(receipt, log_text=log_text,
                     messages=messages, salt=salt, output_token_ids=output_ids)

The production receipt-signing public key is bundled (idemcore.verify.DEFAULT_TRUSTED_KEYS); pass keys=client.keys() to use the live key set instead.

Errors

All errors derive from idemcore.IdemcoreError and carry status, type and message: AuthenticationError (401), PermissionDeniedError (403, key lacks a scope), NotFoundError (404), ConflictError (409), InvalidRequestError (400/415), RateLimitError (429, see .retry_after), InsufficientQuotaError (429), ServiceUnavailableError (503), InternalServerError (5xx), APIConnectionError (network). GET requests are retried on 429/503 (max_retries, default 2); chat requests are never retried automatically, so a retry never creates a second receipt behind your back.

Using the OpenAI SDK instead

The API is OpenAI-compatible, so openai.OpenAI(base_url="https://api.idemcore.net/v1", api_key=...) also works; the receipt is in the response's idemcore_receipt field. This package adds typed receipts and local verification.

Development

pip install -e .
python -m unittest discover -s tests          # mocked API, no network
IDEMCORE_LIVE=1 python -m unittest tests.test_client.LiveSmoke   # GET /health only

License

Apache-2.0

Metadata

Release files for idemcore 0.1.2

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

Source distribution (sdist)

Source distribution for idemcore 0.1.2
File Size Uploaded Provenance Actions
idemcore-0.1.2.tar.gz 30.1 kB With provenance Details for idemcore-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for idemcore 0.1.2
File Interpreter ABI Platform Actions
idemcore-0.1.2-py3-none-any.whl Python 3 none any Details for idemcore-0.1.2-py3-none-any.whl

Total release size: 52.4 kB

Release files / idemcore-0.1.2.tar.gz

Download URL idemcore-0.1.2.tar.gz
Size 30.1 kB
Tags Source
SHA-256 checksum
How to use checksums
382a0982ead60db4ef08ab4d8b2b5390102b7afd07a6b4da86aaecfd46e31a44
BLAKE2b-256 checksum
How to use checksums
22e8fc87af9d26d7474bb2311c86e2fe4951d57d42343ee177b382c2e43ab7b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / idemcore-0.1.2-py3-none-any.whl

Download URL idemcore-0.1.2-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8781faee70ad456f6f575fedab993a6ae3ab041e69de29e0459e01d49fa609a
BLAKE2b-256 checksum
How to use checksums
1bb6ce982611a6825467b2ce658932f58ee517153db8babe2e4c39d1f0b70d57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for idemcore 0.1.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for idemcore-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

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.

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