End-to-end encryption
Encrypt prompts on your machine and completions on our GPU nodes, with the Zro CLI or your own client.
End-to-end encryption (beta) keeps your prompts and completions unreadable between your machine and the GPU node that runs the model:
- Prompts are encrypted on your machine and decrypted only on Zro's GPU nodes.
- Completions are encrypted on the GPU node and decrypted only on your machine.
Our gateway, load balancers and anything else in between see ciphertext in both directions. They still authenticate your key, route the request and bill it, using the model name and token counts, which stay readable.
Everything in the request is encrypted: messages, system prompt, tool definitions, sampling settings, reasoning, tool calls and completions. The scheme is standard RFC 9180 HPKE.
Availability
- Plans: paid plans and usage packs. Encrypted requests from a Free plan
key are rejected with
403(encryption_plan_required). - Models: DeepSeek V4.1 Flash, Abyss 1, GLM-5.3 and Dolly 2 Security. The
signed key list names the current set.
autoisn't supported. - Endpoints: Chat Completions, Responses and Messages, streaming or not.
- Where it runs: only on Zro's own GPU nodes, in the regions your key allows. Encrypted requests are never sent to third-party providers.
Use it with the Zro CLI
Encryption needs the beta release of the Zro CLI:
npm install -g @moonmath-ai/zro@nextTo update the beta, run the same command again. zro install updates to the
stable release, which doesn't include encryption yet.
The CLI runs a local proxy that encrypts each request before it leaves your machine and decrypts the reply. It checks Zro's key list against a root key built into the CLI. If the check fails, nothing is sent.
Add --e2ee to a launch, or set ZRO_E2EE=1. The CLI starts the proxy on a
free local port, points the agent at it, and stops it when the agent exits.
zro launch claude --e2ee --model deepseek-v4.1-flash
zro launch codex --e2ee --model glm-5.3The agent is offered only models that support encryption, so switching models
inside it stays encrypted. Codex App isn't supported; point it at zro proxy
instead.
Use your own client
You can encrypt requests yourself, for example from an app you ship, by following the protocol below. Your client:
- Fetches the key list and verifies its signature against the pinned root key.
- Encrypts your normal request, with a
_zro_apifield added, into an envelope string. - Sends the envelope inside a minimal outer request (the shell) to the usual endpoint, with your API key.
- Decrypts the frames in the response.
The open-source CLI has a reference implementation with no dependencies beyond
Node's built-in crypto,
src/e2ee.ts,
tested against the RFC 9180 test vectors. The
wire protocol
spells out every byte.
How the protocol works
The protocol is called zro-hpke-v1. Each request uses a new HPKE context;
nothing is reused between requests.
1. Fetch and verify the key list
GET https://zro.moonmath.ai/.well-known/zro-encryption-keys.json{
"version": "v1",
"published_at": "2026-12-03T08:38:27Z",
"keys": [
{
"kid": "zro-e2ee-prod-2026-12",
"alg": "HPKE-X25519-HKDF-SHA256-AES256GCM",
"kty": "X25519",
"public_key": "<base64url X25519 public key>",
"fingerprint": "sha256:<hex SHA-256 of the public key>",
"status": "active",
"not_before": "2026-12-03T08:38:27Z",
"not_after": "2027-06-01T08:38:27Z"
}
],
"supported_models": ["abyss1", "deepseek-v4.1-flash", "dolly2-security", "glm-5.3"],
"signature": { "alg": "Ed25519", "root_kid": "<root key ID>", "sig": "<base64url signature>" }
}The list is signed with an Ed25519 root key, so a proxy that terminates TLS can't substitute its own key. Pin this root public key in your client:
7qLRrP9MviWLHYg7pS9rFoHLsfXlxUK7GXUB7xX1MRYIt's the raw 32-byte key in base64url, also published in the DNSSEC-signed
TXT record _zro-e2ee.zro.moonmath.ai.
To verify, remove signature and serialize the rest as canonical JSON: object
keys sorted, no whitespace. Then check signature.sig over those bytes. Check
that each key's fingerprint matches its public_key, and use the first key
whose status is active and whose not_before/not_after window includes
now. All base64url in the protocol is unpadded.
2. Encrypt the request with HPKE
Write the request exactly as you would for the endpoint you're calling:
model, stream, messages, system prompt, tools, max_tokens, sampling
settings. Then add _zro_api to say which API it is:
| Endpoint | _zro_api |
|---|---|
POST /v1/chat/completions | "chat_completions" |
POST /v1/responses | "responses" |
POST /v1/messages | "messages" |
The gateway converts between API formats. _zro_api tells the GPU node which
format the encrypted request is in, and which format to encrypt the response
in.
Seal the JSON of that inner request with HPKE base mode, using DHKEM(X25519, HKDF-SHA256), HKDF-SHA256 and AES-256-GCM:
info = "zro-hpke-v1:" + kid
enc, ctx = SetupBaseS(public_key, info)
ct = ctx.Seal(aad = "req", plaintext = JSON(inner_request))
envelope = "zro-hpke:v1:" + kid + ":" + base64url(enc) + ":" + base64url(ct)
resp_key = ctx.Export("zro-hpke-v1/resp/key", 32)
resp_iv = ctx.Export("zro-hpke-v1/resp/iv", 12)Keep resp_key and resp_iv. Only you and the GPU node that opens the
envelope can derive them, so they're what make the response readable only to
you.
3. Send the shell
Put the envelope in a minimal outer request for the same endpoint. model and
stream must match the inner request.
{
"model": "deepseek-v4.1-flash",
"stream": true,
"messages": [{ "role": "user", "content": "zro-hpke:v1:<kid>:<enc>:<ct>" }]
}Send it with your usual headers: Authorization: Bearer sk-..., or x-api-key
and anthropic-version for Messages. Everything else belongs in the inner
request. The gateway rejects a shell with extra messages or with plaintext
system, instructions or tools next to the envelope, so nothing leaks
unencrypted by mistake.
4. Decrypt the response
The response has its usual shape. The GPU node puts the encrypted content in its text field as one or more frames:
zro-hpke:v1:<seq>:<base64url ciphertext>; data frame
zro-hpke:v1:<seq>:eof:<base64url ciphertext>; end-of-stream frameseq counts from 0. Decrypt each frame with AES-256-GCM using resp_key, a
nonce of resp_iv XOR seq (as a big-endian 64-bit number in the last
8 bytes), and an AAD that binds the key ID and seq. The
wire protocol
has the exact byte layout.
- Not streaming: the text field holds one frame. For Chat Completions it
decrypts to the
choicesarray. For Responses and Messages it decrypts to the full response object. - Streaming: join the text deltas and split them on
;, since a frame can span chunks. Each frame decrypts to a batch of Chat Completionschoicesdeltas, or of{"event", "data"}SSE events for Responses and Messages. The stream ends with aneofframe holding the finish reason and the number of data frames. If a frame is missing, out of order or altered, or theeofframe never arrives, treat the response as failed.
id, model and usage stay readable in their usual places.
What stays visible
The model name, stream, token usage, request and response sizes, and timing
are visible to the gateway and to anything between you and the GPU node. The
GPU node decrypts your request to run the model, as it must, and isn't
hardware-attested.
Errors
Errors use the usual error body of the API you called.
| Status | code | Meaning |
|---|---|---|
400 | invalid_encryption_envelope | The shell or envelope isn't in the format above. |
400 | unknown_encryption_key_id | The key was rotated. Fetch the key list again and retry. |
400 | decryption_failed | The envelope didn't decrypt, or the inner request isn't a JSON object. |
400 | encryption_unsupported_model | The model, or auto, doesn't support encryption. |
400 | encryption_region_unavailable | The model supports encryption, but not in your key's regions. |
400 | encryption_unsupported_endpoint | That endpoint can't take encrypted requests for this model right now. |
403 | encryption_plan_required | Encryption needs a paid plan or a usage pack. |