Hacker News

The Comprehensive Guide to Encrypted Inference with Tees

Comments

A model router is a simple, useful idea: one API, any model. You name the model you want, and the router finds a provider to run it. OpenRouter is the best-known example, and it's become the default way developers reach many models through a single key.

Routing can also be a serious security vulnerability, because every hop is one more place your prompt can be read. Most routers, OpenRouter included, decrypt your request and read it in plaintext. The provider decrypts it again to run the model, and along the way your prompt can pass through load balancers, logging pipelines, caches, and the people who run them.

Each link in that chain is protected by policy at best, so your privacy depends on every party keeping its promise and never being breached. The longer the chain, the more places it can break, and in recent months, it has broken again and again.

In a single week, three incidents came to light. An attacker read stored prompts on GMI Cloud's systems, OpenRouter warned customers that a third party may have read prompts sent to MiniMax models, and Prime Intellect reported that a modified model answered requests to its DeepSeek V4.1 Flash endpoint for about two days. The same week, Together disclosed that an unauthorized party had obtained a subset of prompts sent to it.

Enterprises aren't immune either. A breach at Fireworks may have exposed Notion AI chat transcripts that, according to Notion, Fireworks had contractually committed not to retain.

The need for private routing has never been clearer, and routers are now scrambling to bolt on encryption and trusted hardware. Nito already runs this way in production. Every model in our catalog runs inside a trusted execution environment (TEE), on a path engineered for full performance.

End-to-end encrypted requests are the standard: they stay sealed from your device all the way to the model. For apps that can't yet encrypt on the device, confidential requests offer an alternative that still runs every model in a TEE.

Running TEEs at scale takes specialized expertise, which is why we recently acquired Switchboard, a team with deep experience running and scaling TEE-based platforms. That expertise is now accelerating our push to build the leading verifiably private inference router.

This guide explains private inference from first principles: why ordinary hosting can't keep a prompt private, how TEEs change that, how to verify it yourself, and how we built a router on top of it.

01 What "private" has to mean

"Private" gets used loosely in AI. It can mean five different things, and they're easy to blur.

  • Confidentiality in transit. Data is encrypted between machines, usually with TLS. That's necessary everywhere, but it says nothing about what happens once the data arrives.
  • Confidentiality at rest. Data is encrypted on disks and in databases. Whoever holds the key can read it.
  • Confidentiality in use. Data stays protected while it's being processed. This is the one inference needs, because the model has to work on your prompt.
  • Retention and training. Whether requests are logged, stored, or used for training. This is a company policy: invisible from outside, and subject to change.
  • Verifiability. Whether you can get cryptographic evidence of which hardware and code handled your request, and confirm your connection actually reached them.

Zero data retention (ZDR) has been the default answer so far. It's a contract about storage: the provider agrees not to keep your prompts after processing them. That covers less than many assume.

Your prompt is still readable on the provider's machines during processing, by the serving software and anyone with server access. The terms also often carve out legal holds, abuse monitoring, and stateful features. And the only evidence that ZDR is honored is the provider's own word.

In the Fireworks breach, attackers reached Notion data that, under the contract, should never have been stored.

Routing adds one more question: what happens when the private path goes down? If a request silently falls back to an ordinary server, privacy was never really enforced. A private router has to fail closed.

02 Four ways to build private inference

There are four broad ways to keep a prompt private while a model runs on it. Two questions separate them: what do you have to trust, and what could someone with full control of the server see?

Approach What you trust What someone controlling the server sees Tradeoff
Local inference Your own device Nothing, because there is no server Capacity: the strongest open models need several data-center GPUs' worth of memory
Hosted inference under contract (ZDR) The provider's policy, staff, and audits Your prompts, outputs, and the model's working memory, in plain text Privacy rests on promises you can't verify
Confidential computing (TEEs) The CPU and GPU makers' hardware, plus a specific build you verify before sending anything Only encrypted memory You trust the chip vendors, and there is modest performance overhead
Cryptographic computation (FHE, MPC) Math, plus (for MPC) parties that don't collude Only encrypted data Orders of magnitude slower, and limited to models far smaller than today's leading open models

Of the four, only TEEs keep the operator out while running today's largest open models at production speed. The rest of this guide focuses on that approach.

03 How trusted execution environments work

A model can only work on your prompt once it's decrypted. On an ordinary server, anyone who controls the machine can then read it from memory, whether that's the cloud provider's staff, an attacker with admin access, or the software that manages the machine.

Encryption in transit and at rest doesn't help at the moment that matters, while the model is reading your prompt.

A trusted execution environment solves this inside the processor itself, by enabling confidentiality in use. The chip isolates the workload and encrypts its memory with a key that never leaves the chip, so the machine's owner and everything else on the server see only scrambled bytes. The chip can also produce a signed report of exactly what code is running inside, called an attestation, which lets you verify it from the outside.

AI inference uses two processors, and each needs this protection.

The CPU side: a confidential VM. Cloud servers run many virtual machines (VMs) on shared hardware, managed by software called the hypervisor. On an ordinary server, the hypervisor decides which memory each VM gets and can read any of it. A confidential VM takes away that power. On AMD SEV-SNP, the processor encrypts each VM's memory with its own key and stops the hypervisor from remapping or replaying it. Intel TDX does the same through a small Intel-signed module that sits between the hypervisor and each VM. The serving software runs here: it receives your request, decrypts it, splits it into tokens, and turns the model's output back into text.

The GPU side: confidential computing mode. The model itself runs on GPUs. The weights, the intermediate calculations, and the KV cache built from your prompt all live in the GPU's own memory, which a confidential VM doesn't cover because the GPU is a separate chip. NVIDIA's confidential computing mode, available from the Hopper generation onward, walls GPU memory off from the host, encrypts all data moving between CPU and GPU, and lets the GPU prove itself with its own NVIDIA-signed attestation.

Together, the two chips form one TEE. The GPU is assigned to a single confidential VM, everything crossing between them is encrypted, and each chip produces its own attestation. A complete check verifies both.

Performance holds up. In benchmarks on H100 GPUs, confidential mode added below 7% overhead for most of the LLM workloads tested, with nearly zero overhead for larger models and longer sequences (Zhu et al., 2024). The heavy compute runs inside the GPU at full speed, and encryption applies only to data moving in and out.

The hardware keeps everyone outside the TEE from seeing your prompt, with little effect on how fast the model runs. Inside the TEE, though, the serving software works on your prompt directly, so you also need to know that software is trustworthy: that it isn't logging your prompt or sending it anywhere. Attestation lets you check exactly which software is running before you send anything.

04 Proving what's running: attestation

Encryption gets your prompt safely to whoever holds the key. Attestation tells you who that is. It's how a machine proves, with a signature from the chip maker, that it's genuine hardware running exactly the software you expect, from the operating system to the serving code that runs the model. It also proves that the key you're about to use belongs to that machine.

It works in five steps:

  • Measure. As the confidential VM boots, the hardware takes a fingerprint (a cryptographic hash) of the first code it loads, and each stage fingerprints the next before handing over: firmware, kernel, settings, and the application.
  • Report. The workload asks the processor for a signed report containing those fingerprints, the firmware's security level, and 64 bytes of data of its choosing. The signing key traces back to the chip maker.
  • Check. A verifier validates the signature, confirms the firmware is current, and compares the fingerprints against approved builds.
  • Bind. The workload places a fingerprint of its own encryption key in those 64 bytes. Your app then encrypts to, or connects to, exactly that key, so the machine that proved itself is the machine you're talking to.
  • Stay fresh. Your app either gets a random challenge included in the report or completes a live encrypted handshake with the bound key. Either way, an old report can't be replayed.

Binding (step 4) is the step implementations most often omit. Without it, a valid report proves only that an approved machine exists somewhere, not that your traffic reached it.

A fingerprint is only meaningful if you can trace it back to published source code. The strongest setups build each release in public, sign it, and record it in a public transparency log, so anyone can confirm that the measured code is the published code.

Measurement also has to cover everything that runs. The strongest setups boot from a verified chain onto read-only, integrity-checked disks, so no unmeasured code or data can be loaded later.

Fingerprints can cover the model too. On some of our partners, including the one this guide uses as its example, the attested boot configuration pins the fingerprint (a dm-verity root hash) of a read-only disk holding each model's weights, and every read from that disk is checked against it. A swapped or modified model would produce a different fingerprint, and in that partner's design, its router checks the fingerprint before sending requests to the machine.

Attestation replaces a company's promise with something far narrower and verifiable: one specific, published build that anyone can inspect.

05 How Nito routes privately

From your code's point of view, Nito works like OpenRouter: one OpenAI-compatible API at a single base URL, with streaming and tool calling. You get leading open models, including Kimi K3.1 Pro, DeepSeek V4.1 Flash, and Gemma 4 31B, each with a published price per million tokens. Each app or agent gets its own API key with a daily, monthly, or total spending cap, and usage is prepaid.

Underneath, every model in Nito's catalog runs in a TEE, and the router is designed to do its job without reading your prompt. A router has four jobs: identify you, see which model you asked for, send the request to the right machine, and bill for it. None of them requires reading the content. Your app seals each request on your device to a key the TEE has proven it holds, so the gateway can pass it along but never open it.

Nito works with several hardware partners, and they don't all work the same way. Every one runs models in TEEs, but they prove themselves, encrypt requests, and report usage differently. Most of our models run on one partner's route, which this guide uses as its example.

The journey of an encrypted request

Call any model ID ending in :encrypted from a client that supports encryption. Every model in today's catalog has an encrypted version, on the Chat Completions API. Here's the full journey of one on the example route:

  • Your app fetches the enclave's attestation through Nito.
  • Your app verifies it directly, using the hardware partner's open-source verifier: the signature chain, the signed release and its public log entry, and the key binding.
  • Your app takes the encryption key from the verified report, so it never has to rely on Nito for keys.
  • Your app encrypts the entire request to that key with HPKE (RFC 9180), including messages, system prompt, conversation history, tool definitions, tool calls, and tool results.
  • Nito's gateway independently verifies the same enclave, locks its connection to that enclave's key, and forwards your encrypted request. It never resends it and has no unencrypted path.
  • The enclave decrypts the request, runs the model, and encrypts the reply for your session alone. The reply is authenticated, so your app can detect any tampering.

Other partners use per-message encryption instead: your app encrypts each message to the model's attested key with an authenticated cipher, and tool definitions and results are encrypted on routes that support encrypted tools. Where they aren't supported, the gateway rejects tool requests rather than sending them unencrypted. The attestation response tells your client which protocol to use. Either way, the gateway relays ciphertext it holds no key to open, and your client's own verification is what guarantees that only the enclave can decrypt it.

The router still does all four of its jobs, using only the metadata around each request.

| What the gateway sees | What stays encrypted |

Read on Hacker News ↗ ← Back to News

Comments

No comments yet. Start the discussion.