Getting Started
usertrust
Budget holds, audit trails, and spend limits for every LLM call.
usertrust wraps any LLM client (Anthropic, OpenAI, Google) with a JS Proxy so every governed AI call becomes an auditable, double-entry financial transaction, recorded on a tamper-evident audit chain.
Keep your keys. Keep your billing. Add trust in one line.
import Anthropic from "@anthropic-ai/sdk"; import { trust } from "usertrust"; const client = await trust(new Anthropic(), { dryRun: true, budget: 50_000 }); // dryRun skips TigerBeetle for a first try // ... governed calls ... await client.destroy(); // required — flushes the audit chain and releases its lock
Core guarantees
- Two-phase spend lifecycle — every governed LLM call follows
PENDING hold → LLM call → POST (success) or VOID (failure). The same pattern banks use for credit card holds. - SHA-256 hash-chained audit trail — append-only JSONL. Each event chains from the previous via deterministic canonicalization. Tamper-evident by construction.
- Merkle proofs (RFC 6962) — domain-separated hashing with inclusion and consistency proofs for public verifiability.
- Real double-entry accounting — TigerBeetle ledger with nine transfer codes. Not a counter.
- Duck-typed client detection — works with any Anthropic, OpenAI, or Google SDK. No direct imports.
Explore the docs
QuickstartInstall and make your first governed LLM call in 2 minutesTwo-phase spendHow the banking hold pattern keeps your budget atomicAPI referencetrust(), defineConfig(), error classes, typesCLI commandsinit, inspect, health, policy, verify, export, anchor, snapshot, tb, pricing, budget, completions, secret, skill, ui, audit, reportPolicy engine12 operators, YAML rules, scope globs, time windowsStandalone verifierZero-dependency vault verification
Stack
| Layer | Technology |
|---|---|
| Runtime | Node 22, ESM |
| Language | TypeScript 5.9 (strict, noUncheckedIndexedAccess) |
| Ledger | TigerBeetle |
| Validation | Zod |
| Policy | YAML + minimatch |
| Test | Vitest |
License
Apache 2.0 — View on GitHub