View as Markdown

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 /v1/trace/worker_keys:

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
{
  "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"]
  }'
{
  "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 /v1/mandate/intents or POST /v1/mandate/assessments. 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"
{ "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 /v1/trace/labels. 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 /v1/trace/readings as {"token": "<JWS>"}. It needs no API key: the signature authenticates it.

PartContents
Headeralg: ES256, typ: provenance-trace-reading+jwt, kid: the worker key ID
Required claimstrace_id (trc_ and 32 hex characters, minted by you), model_version_id, prompt_hash, readings, iat
Optional claimssession (agent_id, agent_session_id, 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

SymptomCauseFix
400 parameter_invalid on public_key_pemNot an EC P-256 public keyGenerate the key with prime256v1.
401 trace_reading_signature_invalidA bad signature, or an unknown or revoked keyCheck TRACE_SIGNING_KEY_ID matches a live key.
409 trace_reading_replayedThe trace_id was already ingestedMint a new trace_id per reading.
402 plan_required on worker_keysYour plan's active worker keys are in useRevoke a key, or move to a plan with more.
402 trial_ended on a readingThe Free trial ended, or its 1,000 signed readings are usedChoose a plan.
402 spend_cap_reached on a readingYour account reached its monthly spend capRaise or remove the cap.
503 sidecar_not_configured from the workerSidecar mode is missing a settingSet TRACE_SIDECAR, the signing key and its ID, and PROVENANCE_API_URL.

See also