Self-hosting · Guide
Run a sidecar
Use the sidecar when your model runs on your own GPUs. The trace worker reads the canary neurons next to your model, signs the readings with a key you hold, and sends Provenance only the readings and a prompt hash. Your canary policies then read them with canary_source: "sidecar".
Before you begin: a registry build of your model with its canary sets, a running trace worker, openssl, and an account key on any plan (the examples use the sandbox Enterprise key).
Keys and billing
Every plan can run a sidecar. The Free trial and Pro hold one active worker key, Growth five and Enterprise any number; revoke a key to free its place. Each reading Provenance accepts counts as one signed reading for your account, against your plan's included readings; a refused reading counts nothing. To send fewer, set a sampling rate.
1. Create a signing key and register its public half
Generate an EC P-256 key pair and keep the private half on your worker. Register the public half with POST /:
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
openssl ecparam -name prime256v1 -genkey -noout -out sidecar.key.pem
openssl ec -in sidecar.key.pem -pubout -out sidecar.pub.pem
curl -s $PROVENANCE_API/v1/trace/worker_keys \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d "{ \"name\": \"gpu-pod-eu-1\", \"public_key_pem\": $(jq -Rs . sidecar.pub.pem) }" | tee worker-key.json
import { readFileSync } from "node:fs";
import { Provenance } from "@provenanceauth/sdk";
const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const key = await prov.trace.workerKeys.create({ name: "gpu-pod-eu-1", publicKeyPem: readFileSync("sidecar.pub.pem", "utf8") });
import os
from provenanceauth import Provenance
prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
key = prov.trace.worker_keys.create(name="gpu-pod-eu-1", public_key_pem=open("sidecar.pub.pem").read())
{
"id": "wk_b61c4a263fb72bbdb1871916",
"object": "trace_worker_key",
"name": "gpu-pod-eu-1",
"alg": "ES256",
"created_at": "2026-10-24T13:18:21.528Z",
"revoked_at": null,
"last_seen_at": null,
"public_key_pem": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEjmvCLMKvTx8C9If7PObCQCSNe3Ly\nDZCC+vxLGJt3vSVVUJtoEWfn0Kkql3oGzN4bk09pHJ7W28Os+8o9f6f1Mw==\n-----END PUBLIC KEY-----\n"
}
Only EC P-256 public keys are accepted. The console's Developers → API keys → Sidecar tab does the same.
2. Start the worker in sidecar mode
Run the worker with the private key, the key's ID and your API URL:
export TRACE_SIGNING_KEY_ID=$(jq -r .id worker-key.json)
TRACE_WORKER_BACKEND=hf TRACE_MODEL=<your Hugging Face model> \
TRACE_SIDECAR=1 TRACE_SIGNING_KEY_PEM="$(cat sidecar.key.pem)" \
PROVENANCE_API_URL=$PROVENANCE_API \
provenance-trace-worker serve --port 8090
Sampling
Set TRACE_READING_SAMPLE_RATE on the worker to read a share of requests (from 0 to 1; the default 1 reads every request). The choice comes from the prompt hash, so the same prompt is always read or always skipped. At 0.1, about one request in ten is read and sent.
A skipped request answers "sampled": false with no trace_id: nothing is signed, sent or billed, and a canary policy that needs a sidecar reading for it sees none. A request with kill_switch is always read, since the kill switch needs the readings to stop your model. A value outside 0 to 1 makes the worker answer 503 sidecar_not_configured.
3. Read the canaries before your agent acts
Your agent or gateway calls the worker. The worker reads the canaries, signs the reading and posts it to Provenance, then returns the trace_id:
curl localhost:8090/v1/sidecar/read \
-H "Authorization: Bearer $TRACE_WORKER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model_version_id": "qwen2.5-0.5b-instruct@7ae55760-ad6c88b2",
"messages": [{ "role": "user", "content": "Summarize this vendor email." }],
"canary_sets": ["prompt_injection"]
}'
const reading = await (await fetch("http://localhost:8090/v1/sidecar/read", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.TRACE_WORKER_TOKEN}`, "Content-Type": "application/json" },
body: JSON.stringify({ model_version_id: "qwen2.5-0.5b-instruct@7ae55760-ad6c88b2", messages, canary_sets: ["prompt_injection"] }),
})).json();
import httpx
reading = httpx.post(
"http://localhost:8090/v1/sidecar/read",
headers={"Authorization": f"Bearer {os.environ['TRACE_WORKER_TOKEN']}"},
json={"model_version_id": "qwen2.5-0.5b-instruct@7ae55760-ad6c88b2", "messages": messages, "canary_sets": ["prompt_injection"]},
).json()
{
"trace_id": "trc_6f1c2a9e0b7d4e3a8c5f1b2d3e4f5a6b",
"readings": { "prompt_injection": { "score": 1, "tripped": true, "threshold": 1 } },
"backend": "hf",
"posted": {
"id": "trd_01M5Q1C4X2ZK9V7T6R5P4N3M2L",
"object": "trace_reading",
"trace_id": "trc_6f1c2a9e0b7d4e3a8c5f1b2d3e4f5a6b",
"canary_hash": "9d3b5f2a7c1e8b4d6f0a2c4e6b8d0f1a3c5e7b9d1f3a5c7e9b1d3f5a7c9e1b3d",
"model_version_id": "qwen2.5-0.5b-instruct@7ae55760-ad6c88b2",
"received_at": "2026-10-24T13:20:00.000Z"
}
}
Pass that trace_id to POST / or POST /. Add kill_switch and generation settings to the same call and the worker generates the completion itself, stopping between tokens on a trip; the completion stays with you, and the signed reading adds a trip claim. See Trace rules on model output.
4. Optional: revoke a key
Readings signed by a revoked key are rejected from then on:
export WORKER_KEY_ID=$(jq -r .id worker-key.json)
curl -X DELETE $PROVENANCE_API/v1/trace/worker_keys/$WORKER_KEY_ID \
-H "Authorization: Bearer $PROVENANCE_KEY"
await prov.trace.workerKeys.revoke(key.id);
prov.trace.worker_keys.revoke(key["id"])
{ "id": "wk_b61c4a263fb72bbdb1871916", "object": "trace_worker_key", "deleted": true }
Label neurons with your own key
The worker can label neurons of your registry build with your own Anthropic key and post the labels, signed with your worker key, to POST /. Only the labels are sent, never prompt or example text, and Provenance bills nothing for them. Install the labels extra and run provenance-trace-worker label; see neuron labels.
The reading format
The worker posts each reading to POST / as {"token": "<JWS>"}. It needs no API key: the signature authenticates it.
| Part | Contents |
|---|---|
| Header | alg: ES256, typ: provenance-trace-reading+jwt, kid: the worker key ID |
| Required claims | trace_ (trc_ and 32 hex characters, minted by you), model_, prompt_, readings, iat |
| Optional claims | session (agent_, agent_, so the reading teaches that agent's baseline), predictions (probe outputs, see predictive preflight), trip (when the kill switch fired) |
iat must be within 15 minutes, and no more than 60 seconds in the future. Provenance computes the canary_hash from the claims. A trace_id is accepted once per account.
Limitations: a sidecar reading proves that a key you registered signed these readings for this prompt hash at about this time. Which hardware and weights produced them is yours to vouch for, because you run the model.
Errors you might see
| Symptom | Cause | Fix |
|---|---|---|
400 parameter_ on public_ | Not an EC P-256 public key | Generate the key with prime256v1. |
401 trace_ | A bad signature, or an unknown or revoked key | Check TRACE_ matches a live key. |
409 trace_ | The trace_ was already ingested | Mint a new trace_ per reading. |
402 plan_ on worker_ | Your plan's active worker keys are in use | Revoke a key, or move to a plan with more. |
402 trial_ on a reading | The Free trial ended, or its 1,000 signed readings are used | Choose a plan. |
402 spend_ on a reading | Your account reached its monthly spend cap | Raise or remove the cap. |
503 sidecar_ from the worker | Sidecar mode is missing a setting | Set TRACE_, the signing key and its ID, and PROVENANCE_. |