Unlinkable inference
All 16 rules machine-checked
Use AI models without the server being able to tell which account or payment a chat came from, or which other chats it goes with. The server still reads the prompt, and sees your IP address unless you hide it with Tor or a VPN. THREAT_MODEL.md says exactly what is and is not protected; SPEC.md has the wire format.
Proved, not just tested
Every promise below is checked by a machine on every push, not just by tests. The full wording, the conditions and what the proofs leave out are in spec/RULES.md.
| The promise | Proved with | |
|---|---|---|
| P1 | The server can't tell which account paid for a chat | ProVerif |
| P2 | The server can't tell which chats go together | ProVerif |
| P3 | A pass shows a label and month, never an account | ProVerif |
| P4 | Signing in gives nothing away | ProVerif |
| P5 | Storage only ever gets hashes, never a secret, voucher or pass | Rust's type checker (stored.rs) |
| M1 | No money is made or lost | TLA+ |
| M2 | You never pay more than your requests cost | TLA+ |
| M3 | A voucher is spent once, and only one the server signed | TLA+ |
| M4 | An account never goes below zero | TLA+ |
| M5 | A lost answer never loses money | TLA+ |
| M6 | Promotional credit never turns into paid money | TLA+ |
| M7 | Any amount splits into vouchers worth exactly that | every case in range (exhaustive run) |
| M8 | The change always fits | every case in range (exhaustive run) |
| M9 | Change is exactly what the session holds | every case in range (exhaustive run) |
| M10 | Rounding favours you, by under 1/1000 of a cent | Kani |
| M11 | Withdrawals come in fixed sizes | Kani |
ProVerif proves the privacy rules against a server that can try anything;
TLA+ checks every order the money events can happen in (437,085 states); Kani,
exhaustive runs and the type checker prove properties of the code itself.
spec/mutants.py then breaks the design and the code 29 ways on purpose, and
every proof catches its break, so none of them passes by proving nothing.
Run it all yourself with python3 spec/check.py; spec/README.md
says how to install the tools. The rules can only change when the maintainer
approves them (spec/APPROVED).
How it works, in one paragraph: your device holds a wallet of blind-signed vouchers (Chaumian e-cash: David Chaum's blind signatures, 1982). Each conversation opens a session paid with a few of them and uses a random session secret instead of an API key. When the conversation goes quiet the session closes and the change comes back as fresh vouchers the server has never seen. Everything is derived from the account code (20 characters, 96 bits; older accounts have a 16-digit number), so a device that forgets it all gets the money back at the next sign-in. Nothing depends on a third party.
Use it in an app
The client logic is one Rust crate, unlinkable-inference; browsers get the same
code as WebAssembly in the npm package unlinkable-inference.
Rust (cargo add unlinkable-inference):
use ;
let keys = account_keys?; // account code or 16 digits; slow on purpose, ~1 s
// new accounts: seed::new_account_code(), made on the device
// sign in with keys.login_key; keep keys.seed on the device
let mut m = connect.await?;
m.api_key = Some; // used only to top the wallet up
m.start.await?; // brings back what a lost device left
let secret = m.session.await?; // send as Authorization: Bearer
save; // after every call
// 402: m.ran_out(&secret, attempt), retry. 401: m.expired(&secret), new session.
// Every 30 s: m.tick().await (closes quiet sessions for their change, asks the account at random times).
// With policy.fund_now = false, Err(Refilling): hold the request until m.refilling() is None, then retry.
// A payment or plan change in the app: m.money_added().await.
Browser (npm install unlinkable-inference):
import * as sessions from 'unlinkable-inference';
const = await sessions.; // sign in with loginKey
const u = await sessions.; // wallet kept in localStorage
const res = await u.; // onWait(null): it goes on
u.fetch sends the conversation's session secret with credentials: 'omit',
so no cookie goes with it, and tops the session up when it runs out.
Packages
| Package | What | Licence |
|---|---|---|
unlinkable-inference (crate) |
The library. Client: blind vouchers, wallet, sessions, key pinning, recovery from the account code or number, Manager for apps. With the server feature: the session endpoints and voucher checks (axum) over your storage. |
MIT or Apache-2.0 |
unlinkable-inference (npm) |
The same client compiled to WebAssembly for web pages (wasm, wasm/build.sh) |
MIT or Apache-2.0 |
unlinkable-inference-cli (crate) |
unlinkable-inference: local OpenAI/Anthropic proxy, MCP server, wallet CLI, verify |
GPL-3.0-or-later |
reference-server is not published: the server feature over
in-memory storage with an echo model, play money and a full database dump, for
the tests and for checking what a server learns.
Use it with any agent
As an MCP server (Claude Code, Codex, anything with MCP): the agent starts the proxy and stops it when it exits, closing its sessions. The server entry has no tools:
Claude Code then keeps talking to the server directly; only the key changes,
to a session secret from the proxy. In .claude/settings.json:
One session lasts until Claude Code goes quiet for 5 minutes; the proxy tops
it up as it runs low. Claude Code then sends its own requests, with the fixed
device id it puts in them; to keep that id on your machine, set
ANTHROPIC_BASE_URL to the proxy instead (below), which drops it. Codex has no key helper, so it goes through the proxy
instead, as a provider in ~/.codex/config.toml:
[]
= "Obscurify (private)"
= "http://127.0.0.1:8899/v1"
= "OBSCURIFY_API_KEY"
and a profile next to it, ~/.codex/private.config.toml (Codex 0.169+; codex --profile private):
= "obscurify-private"
= "deepseek/deepseek-v4.1-flash"
Step-by-step for every client: https://obscurify.ai/tutorials/private_sessions
pi: copy integrations/pi/unlinkable-inference.ts to ~/.pi/agent/extensions/. It
starts the proxy when needed and adds an obscurify-private provider with the
same models as your obscurify one; the normal provider stays.
On its own: unlinkable-inference serve (http://127.0.0.1:8899), then use your
usual key and change only the base URL, e.g. Claude Code:
ANTHROPIC_BASE_URL=http://127.0.0.1:8899 ANTHROPIC_AUTH_TOKEN=sk-obs1_… \
ANTHROPIC_MODEL=deepseek/deepseek-v4.1-flash
OpenAI SDKs and curl: base URL http://127.0.0.1:8899/v1, your usual key.
The proxy uses that key for one thing: keeping the wallet (and this month's
passes, where the server gives the account any) topped up in the background, at random times,
so a request rarely needs the account. When one does, it is topped up at once (the two requests
are then seconds apart: see THREAT_MODEL.md, Timing). Keep enough in the wallet (--keep,
default $2) for the replies you expect, and start the proxy with the key (OBSCURIFY_API_KEY) so
it fills the wallet when it starts.
Chats go out with a session secret instead and are charged exactly their tokens, down to 0.001¢.
http://127.0.0.1:8899/_unlinkable shows what the server received for each
request. To hide your IP address too, run the proxy behind Tor or a VPN
(HTTPS_PROXY / ALL_PROXY are honoured).
Verify it yourself
- Open
/_unlinkable, or run with--show-traffic: requests carry a session secret, no cookie, no account key. unlinkable-inference verifycompares the keys the server gives you with your pins and the published pins, and prints what the server received../verify.shrebuilds the binaries in a pinned container and compares hashes with a release.- Run the reference stack (
compose/), use it, then readhttp://127.0.0.1:8250/debug/db(everything the server has) and try to tie a session to the withdrawal that paid for it.cargo testdoes this automatically.
Tests
cargo test runs the reference server and the proxy over real sockets:
withdraw, open, stream (OpenAI and Anthropic), close, change, pinning, retries
after lost answers, spent vouchers; then it reads the server's whole database
and checks nothing links.