SDK
Capture model calls from Python, Node.js or Rust, keep the evidence, seal it later and verify it.
The SDK runs the capture service inside your own process. Your provider client sends its requests through it, the SDK relays each one through a notary, and your code gets the provider's response back together with that call's evidence as bytes. Where those bytes go, a file, a database or a bucket, is up to you: the SDK keeps nothing.
| Package | Language | Plugs into |
|---|---|---|
exalto_capture | Python | httpx2, through CaptureTransport and AsyncCaptureTransport |
@exalto/capture | Node.js | Any client that accepts a fetch, through createFetch |
exalto-capture | Rust | Its own Client; the other two are bindings to it |
No packages are published yet. Build them from the open-source tree, as the Quickstart shows.
Choose a mode
You choose the mode for each call. A failed call never falls back to the other mode, or to an unrecorded one.
| Witnessed | Notarized | |
|---|---|---|
| Call | witness, or mode="witnessed" | capture with a capture key, or mode="notarized" |
| The notary receives | The full request and response, credential included, in memory only | Encrypted TLS records, the provider's hostname, sizes and timing |
| You get back | A .llmtrace, Sealed · Witnessed | A .llmcapture, Captured, encrypted under your capture key |
| Its evidence | The notary operator's signed receipt, not a proof | A TLSNotary proof, once you seal it |
Either way, your process holds the prompt, the response and the provider credential. A call made without the SDK isn't recorded and involves no notary.
Choose a notary
- Exalto's notary:
Notary.exalto(api_key=...)in Python,exaltoNotary(apiKey)in Node.js, orNotary::exalto(Some(&api_key))in Rust. It finds the notary through Exalto's Registry and trusts the keys listed there. It reads the Registry again when a notary signs with a key the copy doesn't list yet, and before every seal, so a long-running process follows key rotations without a restart. Each session is charged to the organization that owns the API key, which needscapture:requestto capture andnotarization:requestto seal. Without a key, sessions draw on a small monthly allowance for your network address. - Your own notary:
Notary(endpoint, public_key), with an endpoint such astls://notary.example.com:7047(tcp://only on loopback) and the notary's hex public key. That key is the trust anchor for everything the notary signs; TLS only authenticates the connection. Your own notary uses no Exalto allowance, and Exalto's hosted verifier won't trust its packages. The open-source runtime explains how to run one.
Plug it into your client
import httpx2
from anthropic import Anthropic
from exalto_capture import Client, Notary
from exalto_capture.transport import CaptureTransport
client = Client(Notary.exalto(api_key=EXALTO_API_KEY))
anthropic = Anthropic(http_client=httpx2.Client(
transport=CaptureTransport(client, mode="notarized", key=capture_key, on_artifact=keep),
))Any client that takes an httpx2 client works the same way, including OpenAI 3.0 or later and Anthropic 1.0 or later. A client built on the older httpx package can't use the transport. For an httpx2.AsyncClient, use AsyncCaptureTransport, whose on_artifact may be a coroutine function.
Each artifact carries its trace_id (traceId in Node.js), its kind (trace or capture), its file extension (llmtrace or llmcapture) and its data. In Rust, kind is an ArtifactKind with extension(), and the bytes are in bytes. It arrives once the response body has been read to the end, so a streamed response hands it over after its last event. Without httpx2 or fetch, call witness or capture directly with the method, URL, headers and body, read the response, then take its artifact.
Tie each artifact to its call
Run calls inside capture_context (captureContext in Node.js) with fields that identify them, such as a user or conversation. Each artifact then carries those fields as its context, even when calls run concurrently or a stream is read later.
from exalto_capture.transport import capture_context
def keep(artifact):
db.save(artifact.context["conversation_id"], artifact.trace_id, artifact.data)
with capture_context(conversation_id=conversation.id):
anthropic.messages.create(model=MODEL, max_tokens=1024, messages=messages)Nested blocks merge their fields, the inner one winning. The fields are read when a request is sent, and they stay in your process: the SDK never sends them or writes them into the evidence.
What can be captured
POSTrequests to five providers. The request URL picks the host:api.openai.com,chatgpt.com,api.anthropic.com,api.deepseek.comoropenrouter.ai. Any other host, scheme, port or method is refused before anything is sent. The notary checks the host against its own allowlist, and resolves and connects to it.- Successful responses. A non-2xx response reaches your code unchanged but produces no artifact, because it can't be sealed. Nor does a response whose body is never read.
- Clients in your own code. Claude Code, Codex and other agents you can't change record through hosted capture instead, where Exalto handles the plaintext and the credential.
Skip some calls
A provider client sends more than model calls. OpenAI's models.list() is a GET, which can't be captured, and Anthropic's token counting is a POST you may not want to pay to record. Give the transport a should_capture function (shouldCapture in Node.js), and a request it declines goes straight to the provider, unrecorded, as it would without the SDK.
def should_capture(request):
return request.method == "POST" and not request.url.path.endswith("/count_tokens")
transport = CaptureTransport(client, mode="notarized", key=capture_key, on_artifact=keep, should_capture=should_capture)The choice is made before anything is sent: a request the SDK tries to capture and can't is never sent unrecorded. Declined requests go through forward, which is a plain httpx2.HTTPTransport in Python and the global fetch in Node.js unless you pass your own, such as one that uses a proxy. In Node.js, shouldCapture receives the Request; don't read its body.
Handle failures
Every SDK failure raises CaptureError in Python, or rejects with an Error in Node.js. The failures you can act on carry a code, and a witness or capture that fails with one sent nothing to the provider.
Node.js error.code | Python | What happened |
|---|---|---|
not_capturable | NotCapturable | The request isn't a POST to a supported provider path, or it's too large to attest. |
allowance_exhausted | AllowanceExhausted | The organization's allowance or plan doesn't cover the session. |
unauthorized | Unauthorized | Exalto refused the API key: it's unknown or revoked, or it lacks the scope the call needs. |
unavailable | Unavailable | Exalto's API or the notary couldn't be reached. Trying again later may work. |
In Rust, ErrorCode::of(&error) returns the code. Whatever you do next is your choice: the SDK never sends the call unrecorded.
A provider client may wrap the SDK's error. OpenAI's Python client raises it unchanged. Anthropic's Python client and both Node.js clients retry the call, then raise their own connection error with the SDK's error as its cause: __cause__ in Python, error.cause in Node.js.
Keep the capture key
A Notarized call needs a CaptureKey: 32 bytes from CaptureKey.generate(), kept with to_bytes() and restored with CaptureKey.from_bytes(). It encrypts every .llmcapture made with it.
- Store the key like the provider credential. With it, a
.llmcapturerebuilds the original request, credential included. Without it, the capture can never be sealed. - Treat every
.llmcaptureas a secret too. Never log, upload or share one. It is never part of a sealed package or a share.
The notary never receives the key or the plaintext. Whoever holds both a .llmcapture and its key can read the request.
Seal later
When you need to prove a Notarized call, pass its .llmcapture and key to notarize. It returns the Notarized .llmtrace.
trace = client.notarize(capture_bytes, capture_key)Sealing runs the TLSNotary proof with a notary holding the signing key that witnessed the call, which Notary.exalto finds in the Registry. It takes far longer than the call did and uses much more CPU and memory, so run it where and when that suits you, such as a background worker. notarize reads the Registry again first to find that notary: seal while the Registry still lists one that seals for that key. A failed seal can be retried: the capture is never consumed. Each seal through Exalto's notary draws on your sealing allowance.
Verify
notary.verify(trace)checks a.llmtraceagainst that notary's keys: for Exalto's notary, a key in its Registry; for yours, its configured key.verify(trace, public_key)checks it against one hex public key.
Both return the evidence_kind (witnessed or notarized), the provider and provider_host, created_at_unix_ms, the notary_public_key, the request_path, the package_sha256 and the exchange as trace_otlp_json, in camelCase in Node.js. A package that doesn't check out raises an error instead. Verification contacts neither the provider nor the notary, nor Exalto: it uses the copy of the Registry Notary.exalto last read.
A passing Witnessed package isn't a proof
Always report the evidence_kind with the result. notarized is a TLSNotary proof; witnessed is the notary operator's signed receipt.
Seal and verify lists every check.
Exalto Capture is not a notary public. Sealing is not a notarial act. A receipt is cryptographic evidence, not a legal instrument. The ECP specification uses "notary" as a technical role term, in the way public-key infrastructure uses "certificate authority."