Run the one-liner installer. No account, no credit card, no dependencies. You get $2 of
credit immediately — enough for hundreds of Haiku calls. ECDSA-P256 signed receipt on
every call. Sign up later and we keep whatever balance is left for you.
macOS / Linux:
Terminal window
curl-fsSLhttps://cloakapi.io/install.sh|sh
Windows (PowerShell 5.1+):
Terminal window
irm https://cloakapi.io/install.ps1 | iex
Verify the sha256 before running. Every sidecar is in sha256sum checkfile format, so on macOS / Linux run curl -fsSLO https://cloakapi.io/install.sh && curl -fsSLO https://cloakapi.io/install.sh.sha256 && sha256sum -c install.sh.sha256 and expect the line install.sh: OK. On Windows run Get-FileHash .\install.ps1 -Algorithm SHA256 and compare the printed hash with the one in the sidecar.
Sidecars: install.sh.sha256 ·
install.ps1.sha256 ·
install.exe.sha256
Sign up at app.cloakapi.io and create a key under
Integration → API keys. If you still had anonymous balance left when you signed up,
it migrates to your account automatically.
No browser? (CI / headless / containers) Get a free-tier key with one curl —
no GUI, no portal:
On-device tokenisation (SDK + MCP) works immediately with this key; LLM relay
is balance-gated (verify email for a $2 trial). Full details, guard rails, and
the email-attached variant: Authentication → Get an API key
(headless / no browser).
Use any standard OpenAI or Anthropic client — only base_url changes:
Terminal window
pipinstallopenai
# or
npminstallopenai
2. Point it at the gateway
from openai import OpenAI
client =OpenAI(
base_url="https://api.cloakapi.io/api/v1",
api_key="cloak_…",
)
resp = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Summarise the attached email"}],
)
print(resp.choices[0].message.content)
Server-side only. SDK calls use bearer-token auth, which browsers
won’t expose cross-origin from docs.cloakapi.io or arbitrary pages.
If you need browser-side calls, run them from https://app.cloakapi.io
(which is on the CORS credentialed allowlist) or proxy through your
own backend. Direct fetches from the docs page itself are blocked by
our CSP — paste the snippet into your own dev environment.
3. Verify the receipt
Every response includes an X-CloakAPI-Receipt-V2 response header
containing a base64url-encoded JSON OpenReceipt envelope. To verify
it without an account, pass the header value verbatim:
Terminal window
# $RECEIPT = the entire X-CloakAPI-Receipt-V2 header value
the signature was made by a key listed in the public JWKS
(https://api.cloakapi.io/api/.well-known/cloakapi-receipt-pubkeys.jwks),
the chain prev_hash links into the previous receipt for the same
tenant.
Offline verification (no gateway round-trip)
The envelope is independently verifiable. Decode the base64url header,
canonicalise the JSON (sort keys, no whitespace), drop the signature
field, SHA-256 it, then ECDSA-P256 verify with the public key whose
kid matches envelope.kid in the JWKS. Both openai-python and
openai-js SDKs return the receipt header directly via
response.headers["x-cloakapi-receipt-v2"].
A reference Python verifier in 30 lines (uses cryptography):
import base64, json, hashlib, urllib.request
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.asymmetric.utils import encode_dss_signature
That’s it — you’re now sending traffic through a gateway that produces
audit-grade evidence on every call.
Where does tokenisation happen on this path? Nowhere — with a bare SDK
pointed at api.cloakapi.io, the gateway is a blind relay: it forwards
your request exactly as your client sent it and never inspects, detects, or
tokenises content on our servers. To have your PII tokenised, it must happen
on your own machine — use Option C below (local proxy), or one of the
other client-side ways (browser chat, desktop app, browser extension).
Option C — client-side drop-in (local proxy)
Run the CloakAPI local proxy on your own machine and point any OpenAI/Anthropic
client at it. The proxy tokenises on your machine, then forwards only tokens
through the CloakAPI gateway to your provider — detected identifiers are
replaced before anything is sent (cloaked ≠ anonymous — bounded by published
recall), and the gateway stays a blind relay (it sees only tokens)
while it meters the call, signs the receipt, and bills the markup. Your
provider, model and BYOK key choice are configured in your CloakAPI account —
the proxy itself accepts no provider URL (it is gateway-locked by design,
so every call gets a signed receipt).
from openai import OpenAI
client =OpenAI(
base_url="http://localhost:8799/v1",
api_key="unused",# the proxy holds your CloakAPI key; provider keys live in your account
)
resp = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Summarise the email from Alice."}],
)
print(resp.choices[0].message.content)
Configure the proxy with your CloakAPI keys by path (never on the command
line):
Terminal window
CLOAK_API_KEY_FILE=/path/to/your/cloakapi-key# your CloakAPI tenant API key
# upstream is always the CloakAPI gateway (https://api.cloakapi.io/api/v1) —
# there is no provider-URL setting; BYOK provider keys live in your account.
# default listen address: 127.0.0.1:8799 (chosen to dodge RStudio/Jupyter/Dask)
# port taken? set CLOAK_PROXY_LISTEN=127.0.0.1:<free-port> and use the SAME
# port in your base_url above — the proxy never silently rebinds.
What’s covered. Structured PII — emails, phones, cards, national IDs,
IBANs, IP addresses (~10 types) — is tokenised deterministically with no
model, always on. Free-form personal names are protected by an optional
on-device mini-AI (Ollama + Phi by default); with it running, names are
tokenised on your machine, and by default, if it is unreachable the proxy
fails closed rather than let a name leak.
Limits (honest).
Streaming is not yet supported — "stream": true returns HTTP 501
(planned for Phase 2).
The proxy is stateless per request — it only detokenises tokens whose
originals were in that same request (fine for normal chat, which re-sends
history). /v1/models and /healthz are available.
Round-trip a file
You’re not limited to text in, text out. Attach a document to any call (see
File attachments) and the model’s response can be
rebuilt into a real file — .docx, .xlsx, .html, and other formats —
client-side, on the device that holds the alias map (the gateway never sees
the plaintext or the file). Format list, fidelity matrix, and the receipt claim:
File rebuild (round-trip).