Receipts are JWS (JSON Web Signature) tokens signed with ES256. Each receipt cryptographically proves that your request was processed by a verified confidential enclave with a specific code measurement. You can verify receipts independently using the router's public JWKS endpoint.
Add the X-Tresor-Receipt: true header to any chat completion request. Optionally include a nonce for replay protection.
curl https://api.trytresor.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Tresor-Receipt: true" \
-H "X-Tresor-Nonce: $(uuidgen)" \
-d '{
"model": "gpt-oss-120b",
"messages": [{"role": "user", "content": "Hello!"}]
}'
The receipt is returned in the X-Tresor-Receipt response header as a compact JWS string.
Install the required packages, then fetch the JWKS from /v1/verify/jwks.json and verify the JWS signature:
pip install pyjwt[crypto] requests
import json, jwt, requests
# Fetch the JWKS from the router
jwks_url = "https://api.trytresor.com/v1/verify/jwks.json"
jwks = requests.get(jwks_url).json()
# The receipt JWS is in the response header or body
receipt_jws = "eyJhbGciOiJFUzI1NiJ9.eyJzY2hlbWEuLi4"
# Decode and verify
from jwt.algorithms import ECAlgorithm
for key_data in jwks["keys"]:
try:
public_key = ECAlgorithm.from_jwk(key_data)
payload = jwt.decode(receipt_jws, public_key, algorithms=["ES256"])
print("Receipt verified:", json.dumps(payload, indent=2))
break
except jwt.InvalidSignatureError:
continue
| Field | Description |
|---|---|
schema_version | Receipt schema version (e.g. "1.0.0") |
receipt_type | "model" or "message" |
enclave_measurement | Launch digest (hash) of the enclave code |
policy_hash | Attestation policy hash |
selected_model | Model info: provider, model_id, model_hash |
nonce | Client-supplied nonce for replay protection |
issued_at | RFC 3339 timestamp |