Skip to main content

Verdifax Python SDK

Cryptographic attestation for AI inference. Three lines: send a payload, get a sealed manifest hash, anchored on a public log, you can give to an auditor.

Install

pip install verdifax

Quickstart

import verdifax

receipt = verdifax.attest(
    payload="hello verdifax",
    program_id="a" * 64,
    route_id="route-test",
    registry_record_hash="b" * 64,
)
print(receipt.manifest_hash)

That's it. The receipt's manifest_hash is a 64-char SHA-256 that seals every input, every kernel execution ID, the hardware attestation, the ZK transcript, the formal verifier status, and the final VFA. You can later ask the server to re-derive it from the run's stored manifest with verify_run(receipt.run_id); see Verification.

Versioning

From 1.0, a breaking change needs a new major version.

Configuration

By default the SDK talks to the production API at https://api.verdifax.com. Override with environment variables (for example, to point at a local orchestrator):

export VERDIFAX_BASE_URL=https://api.verdifax.example.com
export VERDIFAX_API_KEY=your-api-key
Setting Argument Environment variable Default
Base URL base_url VERDIFAX_BASE_URL, then VERDIFAX_API_URL https://api.verdifax.com
API key api_key VERDIFAX_API_KEY none
Timeout timeout, in seconds VERDIFAX_TIMEOUT_MS 90 seconds
User agent user_agent VERDIFAX_USER_AGENT verdifax-python/<version>
Retries max_retries VERDIFAX_MAX_RETRIES 3
First retry delay retry_base_delay, in seconds none 0.2 seconds

Both clients read the base URL and API key from the environment. verdifax.from_env() also reads the timeout, user agent and retry variables.

GET, HEAD and OPTIONS requests are retried after a transport failure or an HTTP 429, 502, 503 or 504, with exponential backoff and full jitter. POST is never retried.

Or construct a client explicitly:

from verdifax import VerdifaxClient

client = VerdifaxClient(base_url="https://api.verdifax.example.com", api_key="...")
receipt = client.attest(payload="...", program_id="...", route_id="...", registry_record_hash="...")

Async

import asyncio
from verdifax import AsyncVerdifaxClient

async def main():
    async with AsyncVerdifaxClient() as client:
        receipt = await client.attest(
            payload="hello verdifax",
            program_id="a" * 64,
            route_id="route-test",
            registry_record_hash="b" * 64,
        )
        print(receipt.manifest_hash)

asyncio.run(main())

Methods

VerdifaxClient has these methods, and AsyncVerdifaxClient has each of them as a coroutine.

Method Endpoint Auth
health() GET /health none
version() GET /version none
get_openapi() GET /openapi.json none
get_stats() GET /stats required
attest(...) POST /execute required
execute(...) POST /execute required
attest_claude_response(...) POST /execute required
attest_openai_response(...) POST /execute required
execute_batch(runs) POST /execute/batch required
verify_determinism(...) POST /execute/verify-determinism required
get_run(run_id) GET /runs/{run_id} required
verify_run(run_id) GET /runs/{run_id}/verify required
list_runs(limit, offset) GET /runs required
search_runs(...) GET /runs/search required
export_runs(from_, to, job_id) GET /runs/export required
export_runs_csv(from_, to, job_id) GET /runs/export?format=csv required
get_run_artifacts(run_id) GET /runs/{run_id}/artifacts required
get_run_report(run_id) GET /runs/{run_id}/report required
download_audit_pdf(run_id, format) GET /runs/{run_id}/report.pdf required
get_allow_token(run_id) GET /runs/{run_id}/allow-token required
get_deny_receipt(run_id) GET /runs/{run_id}/deny-receipt required
get_ccv_halt_receipt(run_id) GET /runs/{run_id}/ccv-halt-receipt required
get_macc_halt_receipt(run_id) GET /runs/{run_id}/macc-halt-receipt required
get_aivp_t4_halt_receipt(run_id) GET /runs/{run_id}/aivp-t4-halt-receipt required
get_attestation_gap_receipt(run_id) GET /runs/{run_id}/attestation-gap-receipt required
get_ces_audit_record(run_id) GET /runs/{run_id}/ces-audit-record required
list_deletion_receipts(run_id) GET /runs/{run_id}/deletion-receipts required
list_attestations(limit, offset) GET /attestations required
get_attestation(attestation_id) GET /attestations/{id} required
get_public_bundle(run_id) GET /runs/{run_id}/bundle.json none
get_public_bundle_by_token(token) GET /public/runs/{token}/bundle.json none
dcae_verify(bundle) POST /dcae/verify none
register_request_key() POST /keys/request-key required
rotate_request_key(new_signing_key) POST /keys/request-key required
clear_request_key() DELETE /keys/request-key required
admin_create_key(name) POST /admin/keys admin
admin_list_keys() GET /admin/keys admin
admin_revoke_key(key_id) DELETE /admin/keys/{id} admin
admin_clear_request_key(key_id) DELETE /admin/keys/{id}/request-key admin
admin_erase(...) POST /admin/erase admin

These functions make no request: verdifax.research.capture_environment, format_provider_payload, sign_request, sign_request_v2, request_key_registration_body, request_signature_preimage, request_signature_preimage_v2, request_key_change_preimage, generate_request_key, validate_hex64, validate_route_id, and in verdifax.section0, dse_dispatch_hash, dcae_closure_hash and cres_receipt_hash. RUN_STATUSES lists every run status the server uses.

get_run_artifacts, get_public_bundle and get_public_bundle_by_token return the exact JSON text the server sent, so you can save it and check it with verdifax-verify.

Batch runs

execute_batch(runs) sends up to 1,000 runs in one request and raises ValidationError for more, before sending anything. A row that fails comes back in results with ok set to False, so the call does not raise for it. Each row is an ExecuteRequest, or a mapping with the same names as attest().

batch = client.execute_batch([
    {"payload": "first", "program_id": "a" * 64, "route_id": "route-test", "registry_record_hash": "b" * 64},
    {"payload": "second", "program_id": "a" * 64, "route_id": "route-test", "registry_record_hash": "b" * 64},
])

for row in batch.results:
    print(row.index, row.ok, row.run_id, row.error)

A row can carry a job block, which is checked before sending. With a signing key each result row has its own signed_request, and every row that sealed a record has its record_hash.

The client's timeout covers the whole batch, so raise it for a large one. A batch is one POST and it is never retried. After a timeout the server may have run some or all of the rows, so list your runs before you send them again.

Evidence export

export_runs lists the runs the server holds for your key in a period, failures included, with up to 10,000 rows per export. export_runs_csv returns the same rows as raw CSV text.

evidence = client.export_runs(from_="2026-11-01T00:00:00Z", to="2026-12-01T00:00:00Z")
print(evidence.total, evidence.truncated, evidence.by_status)

export = client.export_runs_csv(from_="2026-11-01T00:00:00Z", to="2026-12-01T00:00:00Z")
if export.truncated:
    print(f"The CSV holds part of {export.total} runs. Use a narrower period.")
csv_text = export.csv

Pass job_id to either method to export one job. Rows carry anchor_source, job_id and step_id.

The export states what the server stored, not a verdict. A call that never reached Verdifax cannot appear in it. Both forms say when a period holds more rows than the export returned: check truncated. export_runs_csv reads total and truncated from the X-Verdifax-Total and X-Verdifax-Truncated response headers, and raises VerdifaxError if the server does not send them. In the CSV, a route_id that a spreadsheet could read as a formula gets a leading '.

Jobs

A job is a map of sealed steps. Each step names the records it directly follows, so a missing, swapped or repeated step is visible, and work can split into branches and join again.

client.job(job_id) returns a helper that keeps the map for you. step takes everything attest takes, runs one step, and links it by step id. It raises ValidationError for any other option, job included, before anything is sent, so a typo like afer can never silently use the default link:

run = {"program_id": "a" * 64, "route_id": "route-test", "registry_record_hash": "b" * 64}

job = client.job("loan-1")
job.step("intake", payload="application", **run)

# Two steps after intake.
job.step("credit", after=["intake"], payload="credit check", **run)
job.step("fraud", after=["intake"], payload="fraud check", **run)

# A final step joining them.
job.step("decide", after=["credit", "fraud"], final=True, payload="decision", **run)

print(job.record_hashes)  # step id to record hash

Without after, a step follows the step run just before it through this helper, or nothing if it is the first. after=[] starts another root step. An after naming a step the helper has not recorded raises ValidationError before anything is sent. external_previous takes record hashes from another account. AsyncVerdifaxClient.job returns the same helper with step as a coroutine.

A refused or halted step still seals a record. The helper records its hash, then raises the same error attest raises, so a later step can name the refused step in after. A call that sealed nothing, such as a step id already taken, a timeout or a connection failure, is not recorded and does not change which step comes next by default. After a timeout or a connection failure the server may have run the step. A successful step with no record_hash uses a top-level manifest_hash, then the manifest's own hash, and with none of them the helper raises VerdifaxError, so the map never silently gets a gap.

Without the helper, pass job={"job_id": ..., "step_id": ..., "previous_record_hashes": [...], "external_previous": [...], "final": True} to attest, execute or a provider helper, or put it in a batch row. A determinism check runs twice, so it cannot be a job step. job_id and step_id are 1 to 128 letters, digits, ., _, : or -, and the client raises ValidationError for any other name. It also refuses an unknown field, a final that is not a bool and a hash list that is not a list, because a typo must never silently drop a link. It sorts both lists and removes repeats for you.

The receipt from attest has record_hash, and an error from a refused or halted run has it too.

A job map covers what was sent. It cannot show a step that was never sent.

Determinism check

client.verify_determinism(...) runs one payload twice on the server and compares the manifest hashes. deterministic is true when both runs ended ok and the two hashes match. Both runs are recorded, with the status probe. verdifax.research.verify_determinism(client, ...) is the same call for a sync client.

Verification

Ask the server to re-derive a recorded run's manifest hash and compare it with the recorded seal:

result = client.verify_run(receipt.run_id)
assert result.verified, result

verify_run calls GET /runs/{run_id}/verify with your API key. The server loads the run's stored manifest fields, recomputes the manifest hash from them, and compares it with the hash it recorded when the run was sealed. It does not re-run the pipeline, and it is a check performed by Verdifax. For an independent offline check of the sealed audit bundle, use the open-source verdifax-verify CLI. It recomputes the section hashes, the bundle hash, the pre-anchor digest and the anchored leaf; it does not recompute the manifest hash itself.

verdifax.verify_run(run_id) and AsyncVerdifaxClient.verify_run(run_id) do the same thing.

verify() raises as of 0.6.0

verify() used to call attest() again with the same inputs and compare manifest hashes. That comparison can never match in production: every run seals its own admission clock, nonce, and public-log entry into its manifest hash. It now raises verdifax.UnsupportedOperationError explaining this. Use verify_run(run_id) for a recorded run, or verdifax.research.verify_determinism(...) to check that the pipeline replays deterministically under a pinned clock and nonce.

Request signing

Request signing is optional. A client with no signing key sends the same requests as before.

You can register an Ed25519 public key on your API key, so that each run must also be signed with a private key that only you hold. The key pair is created on your machine, and Verdifax receives only the public key. Signing needs the cryptography package:

pip install "verdifax[signing]"
import verdifax
from verdifax import VerdifaxClient

# Run once, then store private_key as a secret. It is 32 raw bytes.
private_key = verdifax.generate_request_key().private_key

client = VerdifaxClient(signing_key=private_key)
client.register_request_key()  # sends the public key with its proof

# attest, execute, the provider helpers, execute_batch and verify_determinism
# now sign.
receipt = client.attest(
    payload="first signed attestation",
    program_id="a" * 64,
    route_id="route-test",
    registry_record_hash="b" * 64,
)

# The current key approves its replacement. This client then signs with the new key.
client.rotate_request_key(verdifax.generate_request_key().private_key)

client.clear_request_key()  # stops requiring signatures on this API key

AsyncVerdifaxClient takes the same signing_key and has the same three methods. verdifax.attest and the provider helpers accept signing_key= when they build their own client, and verdifax shadow takes --signing-key-file, a file holding the base64 private key.

A signed call sends the request once, as exact JSON text, with a signature that covers those bytes and the job block:

{"signed_request": "<the JSON text>", "request_signature": {"version": "2", "signature": "...", "signed_at": "...", "nonce": "..."}}

The receipt keeps that text as signed_request. Save it to a file to check the record with verdifax-verify --request FILE. An error from a refused or halted run carries signed_request as an attribute, and it is left out of the error's message, so it does not reach your logs. execute returns only the manifest, so use attest to keep the text from a sealed run. DeterminismResult and each row of a batch result carry it too. The job helper keeps it in job.signed_requests, step id to text, beside job.record_hashes, refused and halted steps included.

Replacing or clearing a registered key needs the approval of the current key, and rotate_request_key and clear_request_key send it for you. After a clear the client drops its signing key and sends unsigned requests, because the server refuses a signature on an API key with no registered key. If you lost the key, an administrator can clear it with admin_clear_request_key(key_id). That call does not change the admin client's own signing key.

Registering a key changes that API key for every client that uses it: the server then refuses a run without a valid signature, so every caller on the key needs the private key. Each request carries the time and a fresh random nonce. The server refuses a repeated nonce and a time more than five minutes from its own clock.

In a batch each row carries its own signature and nonce, and the server checks them as it reaches that row. A row refused for its signature comes back in results, so a repeated batch returns HTTP 200 with failed rows, and a row reached more than five minutes after it was signed fails the same way. A determinism check uses one signature for the request, and repeating it returns HTTP 403.

A signature shows who requested the run, not that they accepted the outcome.

sign_request and request_signature_preimage still build the earlier version 1 signature, which the server refuses for a job step. sign_request_v2 and request_signature_preimage_v2 build what a client sends.

Optional execute fields

attest, execute, execute_batch and verify_determinism accept attested_context, reproducibility_context, request_substance, authorization_chain, regulatory_scaffolding and causal_graph. Each is recorded as supplied and Verdifax does not check it. The client derives attested and declared from the fields you provide. Leave out request_substance["origin"]["source_ip_hash"] and ["user_agent_hash"]: the server computes them. attest, execute and verify_determinism refuse them before sending, and a batch row that sets them fails in results.

These methods check that program_id and registry_record_hash are 64 lowercase hex characters and that route_id is 1 to 256 printable ASCII characters. A route_id outside that range now raises ValidationError here, although the server accepts a wider set.

import verdifax

receipt = verdifax.attest_claude_response(
    prompt="What is the boiling point of water?",
    response="100 °C at sea level.",
    program_id="a" * 64,
    route_id="claude-route",
    registry_record_hash="b" * 64,
)

There is also verdifax.attest_openai_response(...) with the same signature, and both are methods on VerdifaxClient and AsyncVerdifaxClient. Both accept the same optional job block as attest, and return record_hash and signed_request the same way.

The helpers attest a prompt and response as one payload: canonical JSON, exactly {"prompt":...,"provider":...,"response":...} with sorted keys and no extra whitespace, UTF-8, with provider set to anthropic or openai. verdifax.format_provider_payload builds that text. All four Verdifax SDKs produce the same bytes. A helper call from an earlier version used a different payload, so it gave a different hash for the same text; records already stored are not touched.

govern is false by default. Set govern=True to also send the response text as ai_output_text for the AIVP review, which runs on Anthropic in production. Without it, the AI output text is not sent for review.

License

MIT

Metadata

Release files for verdifax 1.1.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 verdifax 1.1.0
File Size Uploaded Provenance Actions
verdifax-1.1.0.tar.gz 100.7 kB With provenance Details for verdifax-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 164.0 kB

Release files / verdifax-1.1.0.tar.gz

Download URL verdifax-1.1.0.tar.gz
Size 100.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1a6852f20e8a02633c7cfe7f3750a7e6dd2f61b5039a346826f12e50d332f3c8
BLAKE2b-256 checksum
How to use checksums
6b296495941c06faf4fe42631045a10f7876de6e981a4d30aaa8d821a815081e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 6, 2026.

Transparency log

Release files / verdifax-1.1.0-py3-none-any.whl

Download URL verdifax-1.1.0-py3-none-any.whl
Size 63.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b2447a1fc02bd45f7698c4d123bb6ee3da55b37fd73b40ab9af39645df19870
BLAKE2b-256 checksum
How to use checksums
70875b840723c8f6fbe1598271e4e15d9cc5f45a80398e0e59148bceeb18f515
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 6, 2026.

Transparency log

Security for verdifax 1.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for verdifax-1.1.0.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 6, 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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files Full 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