Skip to content

LiteLLM → QuantZK adapter

Record LiteLLM (or OpenAI-compatible) completion usage as QuantZK portable receipts.

Path: integrations/litellm-quantzk/

What it does

On each successful completion callback:

  1. Extracts event_id, tenant/customer, token/unit counts, and unit price
  2. Calls QuantZK record() (sync or async)
  3. Optionally writes a .qzk file or posts a webhook with the receipt

Python callback

python
# integrations/litellm-quantzk/quantzk_callback.py
from quantzk_callback import QuantZKSuccessCallback

# Configure env:
#   QUANTZK_API_URL=https://api.quantzk.com
#   QUANTZK_ATTEST_SECRET=...
#   QUANTZK_ASYNC=true   # optional high-QPS path

Wire into LiteLLM custom callbacks per LiteLLM docs (success callback / logging callback).

Node callback

js
// integrations/litellm-quantzk/callback.mjs
import { createQuantZKCallback } from './callback.mjs';

See integrations/litellm-quantzk/README.md for full env vars and examples.

Pilot expectations

  • Prefer async (QUANTZK_ASYNC=true) for high QPS; poll or webhook for .qzk
  • Store event_id for idempotent retries
  • Offline verify with @quantzk/verify + QZR-1 Standard when Phase-2 binding is enabled server-side

Full integration checklist

See the design partner kit.

See also

Verification keys are embedded in attestations. Verify offline. No QuantZK servers required.