Skip to main content

Cryptographic evidence receipts for AI decisions

Project description

Veratum Python SDK

Cryptographic evidence receipts for every AI decision.

One line of code. Every AI call gets a tamper-evident receipt stored in a WORM evidence vault — auditable, verifiable, compliance-ready.

pip install veratum

Quickstart

import veratum
import openai

sdk = veratum.init(api_key="vrtm_live_...")
client = sdk.wrap(openai.OpenAI())

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Approve this loan?"}],
)

print(response.veratum_receipt)
# Receipt(id=019d8ed6..., status=committed)

That's the whole integration. sdk.wrap() wraps any OpenAI or Anthropic client; every subsequent chat/message call emits a receipt attached as response.veratum_receipt. If Veratum is unreachable, the AI call still returns — the receipt is just None.

Explicit mode

For custom pipelines or non-wrapped code paths, submit receipts directly:

receipt = sdk.record(
    input_hash=veratum.hash(my_input),
    output_hash=veratum.hash(my_output),
    model_id="gpt-4o",
    agent_id="loan-officer-agent",
    decision_type="credit-approval",
    metadata={"applicant_id": "A-12345"},
)

print(receipt.record_id)

Verify a receipt

result = veratum.verify(record_id="019d8ed6-...")
assert result.valid

Configuration

Parameter Env var Default
api_key VERATUM_API_KEY (required)
base_url VERATUM_BASE_URL https://api.veratum.ai
environment VERATUM_ENVIRONMENT production
timeout VERATUM_TIMEOUT 5 (seconds)
async_submit VERATUM_ASYNC true

Supported integrations

OpenAI

import openai
client = sdk.wrap(openai.OpenAI())
# or async:
client = sdk.wrap(openai.AsyncOpenAI())

Install with: pip install "veratum[openai]"

Anthropic

import anthropic
client = sdk.wrap(anthropic.Anthropic())

Install with: pip install "veratum[anthropic]"

LangChain

from langchain_openai import ChatOpenAI
from veratum.integrations.langchain import VeratumCallbackHandler

handler = VeratumCallbackHandler(sdk, decision_type="rag")
llm = ChatOpenAI(callbacks=[handler])

Records one receipt per LLM call. With record_tools=True (default) also records each tool invocation in a chain.

Install with: pip install "veratum[langchain]"

LiteLLM (140+ providers)

import litellm
from veratum.integrations.litellm import install_litellm_callback

install_litellm_callback(sdk, decision_type="general")

# Every litellm.completion() call now emits a receipt.
response = litellm.completion(
    model="bedrock/anthropic.claude-3-sonnet",
    messages=[{"role": "user", "content": "hi"}],
)

Install with: pip install "veratum[litellm]"

Error handling

The SDK never blocks an AI call on Veratum failure. When using wrap(), if the Veratum API is down or rejects the request, the AI response returns normally with response.veratum_receipt = None.

For explicit record() / verify() calls, errors surface as exceptions:

Exception When
VeratumConfigError Missing API key or required arg
VeratumAuthError 401/403 from the server
VeratumTimeoutError Submission timed out
VeratumAPIError Other non-2xx response

Hashing

All hashes are SHA-256 over canonical JSON (sorted keys, compact separators, UTF-8). This means two logically identical payloads always produce the same hash regardless of dict key order or serialization style.

veratum.hash("hello")              # hex digest of UTF-8 bytes
veratum.hash({"b": 2, "a": 1})     # canonicalized JSON
veratum.hash(b"raw bytes")         # SHA-256 of the bytes
veratum.hash_messages(messages)    # OpenAI-format chat messages
veratum.hash_response(response)    # OpenAI / Anthropic response objects

Links

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

veratum-0.1.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

veratum-0.1.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file veratum-0.1.1.tar.gz.

File metadata

  • Download URL: veratum-0.1.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for veratum-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6205f9db99694098c58bb9a8edad161600cacc69ba22aa66e7930c35fed83196
MD5 41c4638bb44cdb922110d9e444cc26f9
BLAKE2b-256 9fdb9bb9d461f3c9142d54f05c66796b01ba67d323dec056c3d80591f286760c

See more details on using hashes here.

File details

Details for the file veratum-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: veratum-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.11.9

File hashes

Hashes for veratum-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2dbd00619abd4b75a630f5d32ac694b2e1562ce0f6d7c973cd861b3268bdf1c
MD5 5c3ea0983bf450f6e4d705527d6761b9
BLAKE2b-256 47df5756c45e156dceb0a35a7c30a4c0c51033cc219eeef24a58b780278b20ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page