HIPAA-compliant LLM API: what a BAA covers, and what it doesn't
By Nukri Basharuli and George Zhgenti Here is the setup we hear about most often. A clinic wants a model to draft discharge summaries. The input is physician notes, lab results and medications; the output is a draft the
By Nukri Basharuli and George Zhgenti
Here is the setup we hear about most often. A clinic wants a model to draft discharge summaries. The input is physician notes, lab results and medications; the output is a draft the physician reviews. The team picks an LLM API, confirms the provider will sign a Business Associate Agreement, signs it, and wires it up. On paper, they're covered.
On the wire, nothing changed. A BAA is a contract: the provider agrees to safeguard PHI and accepts liability if it doesn't. The prompt with the patient's record still arrives at the provider's servers in the clear. The inference process reads it. So can an administrator with access to the host, the cloud operator underneath the provider, and anyone who gets into that machine's memory. The BAA decides who is responsible after a leak. It does nothing to stop one.
HHS made this point in its 2016 cloud computing guidance: a cloud provider that stores ePHI is a business associate even if the data is encrypted and the provider has no key. The regulator assumes that whoever sits in the data path has access. With an LLM API that's literally true, because the model has to read the text to do anything with it.
What can change on the technical side
Current server GPUs can run in confidential mode. The model runs inside a hardware-isolated trusted execution environment (TEE), memory is encrypted, and the host, the cloud and the operator (in our case, us) can't see prompts or outputs.
For a compliance team, the more useful part is that the environment can prove what's running in it. It produces signed evidence: which code, which container images, pinned by digest, on what kind of hardware.
We built Confidential Router, an OpenAI-compatible API where every model runs this way, and Gatekeeper, a small proxy that runs on the client side and checks that evidence before the first request with PHI leaves your machine.
curl -fsSL https://github.com/Super-Protocol/confidential-router/releases/latest/download/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
gatekeeper init
gatekeeper endpoint add router --upstream https://api.router.superprotocol.com --listen 127.0.0.1:8787
gatekeeper endpoint trust add router --from-upstream
gatekeeper run
Your code only changes the base URL:
from openai import OpenAI
client = OpenAI(
base_url="http://127.0.0.1:8787/v1", # local Gatekeeper
api_key="sk-tee-v1-...",
)
resp = client.chat.completions.create(
model="<model-id>",
messages=[{"role": "user", "content": "Draft a discharge summary from these notes: ..."}],
)
If anything doesn't check out (the signature, the certificate chain, the TLS certificate you actually connected to, or a change in the pinned deployment), Gatekeeper returns a 503 and the request never leaves the machine. Treat that as a security event, not a transient error, and don't fall back to an unverified endpoint.
What this changes for the compliance team
Instead of "the provider says so," you get a record: on this date, before any data was sent, we verified that it would be processed by this code inside an isolated environment. That record can sit in the audit file next to the BAA.
The limits, stated plainly
- You still need a BAA. Attestation doesn't replace it, and we sign one.
- This works for open-weight models only (gpt-oss, Llama, Qwen, DeepSeek, MedGemma). You can't run closed GPT or Claude models this way.
- Today Gatekeeper checks the signature, the certificate chain, the TLS binding and the deployment policy. It doesn't yet verify the GPU's own hardware attestation; that's the next step.
- Attestation proves which code is running. It doesn't prove the code is good. That's one reason Gatekeeper is open source: you can read what it checks.
In production, Yma Health runs MedGemma 27B on patient records this way for clinics in Dubai.
Try it
- Confidential Router: superprotocol.com/developers/router
- Gatekeeper source (Apache-2.0): github.com/Super-Protocol/confidential-router
- Inspect a live evidence bundle in your browser: Evidence Inspector on Hugging Face
- Earlier walkthrough: Point your OpenAI client at a model that can't read your prompts
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.