Budget holds, audit trails, and spend limits for every LLM call. Keep your keys, keep your billing. Add trust in one line.
One line
Your API keys. Your billing. Your provider. trust() adds budget holds and audit trails on top — nothing changes except now you have control.
await trust(client) call — nothing else changesreceipt with hash-chained proofimport { trust } from "usertrust"
import Anthropic from "@anthropic-ai/sdk"
// Your keys. Your billing. Now trusted.
const client = await trust(new Anthropic())
const { response, receipt } = await client.messages.create({
model: "claude-sonnet-4-20250514",
messages: [{ role: "user", content: "Hello" }]
})
receipt.auditHash // SHA-256 hash-chained audit link
receipt.cost // 0.0032
receipt.settled // true
receipt.model // "claude-sonnet-4-20250514"What you get
Observability tells you what happened. Governance prevents what shouldn't.
Budget held before execution. Settled on success. Voided on failure. Like a credit card hold at a gas pump.
Spend limits, model allowlists, PII blocking, rate limits. Enforced before the call — not after.
Every transaction links to its predecessor via SHA-256. Tamper-evident by construction. SOC 2 ready.
Keep your API keys. Keep your billing. trust() wraps your existing client — nothing changes.
Run locally with JSON receipts. No account needed. No SaaS dependency. Read every line of code.
No config files, no dashboard setup, no SDK initialization ceremony. One function call.
Every trust() call follows the same settlement pattern used by payment networks worldwide. No step may be skipped.
Budget hold creation
Before any LLM call executes, trust() reserves tokens from the user's budget — the same hold pattern banks use for credit card authorizations.
Must never: execute the LLM call, skip budget verification, allow negative balances
Policy gate + LLM call
The policy gate evaluates every request before it reaches the provider. PII detection, model allowlists, rate limits, and spend caps — all enforced before the call, not after.
Must never: forward without a PENDING hold, bypass policy evaluation, cache responses
Settlement on success
On success, the hold is settled at the actual cost — calculated from real token usage, not the estimate. Any overage is refunded immediately.
Must never: settle without a preceding PENDING, skip audit chain append
Release on failure
On failure, the entire hold is released — zero charge. The error is classified and recorded in the audit trail, never suppressed.
Must never: charge partial amounts on failure, suppress errors, skip DLQ
Hash-chained audit proof
Every call produces an immutable receipt — a hash-chained proof that links to every prior transaction. Tamper-evident by construction.
Must never: modify historical receipts, break the hash chain, skip the GENESIS anchor
5 PHASES · 3 STORAGE SYSTEMS · 1 UNIVERSAL JOIN KEY (transferId)
trust() wraps your existing provider client. No proxy. No routing. No new accounts. Just trust on top of what you already use.
Your trust layer shouldn't be a black box. UserTrust is open source under the Apache 2.0 license.