Cover illustration for “Structuring the HIPAA Compliance Layer When Your App Cannot Control What PHI Users Type Into an LLM Prompt”

Essay BAA Requirements

Structuring the HIPAA Compliance Layer When Your App Cannot Control What PHI Users Type Into an LLM Prompt

A single gateway chokepoint can govern every route PHI takes.

A HIPAA-compliant AI gateway for teams handling PHI must enforce redaction, BAA-covered routing, scoped access, and audit controls across the request pipeline. Free-form prompts make input-side warnings insufficient because PHI also enters through retrieval, tools, logs, and fallback routes. The compliance layer therefore belongs at a single gateway chokepoint, with explicit controls for every place PHI can travel or persist, including redacting PHI before it reaches model providers.

Why free-form LLM prompts make input-side controls structurally insufficient

A clinical assistant that summarizes notes or drafts a prior-auth will receive names, diagnoses, and patient identifiers. Those details are part of the work. A warning above the prompt field cannot change what a clinician needs to describe, and the resulting ePHI requires safeguards regardless of how it entered the system.

The prompt field is only one entry point. PHI can travel through direct prompts, retrieved RAG context, tool results, request logs and exports, and fallback routing to a provider without a BAA. Blocking identifiers that users enter closes the first path but leaves the others open. A request that looks harmless when sent can pick up patient information when retrieval or a tool adds context.

Scope follows the data. An LLM deployment falls within HIPAA scope when the model can receive PHI in prompts or retrieved context, or when its outputs feed decisions about individual patients. Input controls cannot govern that whole path.

What the HIPAA Security Rule technically requires from an AI system in this situation

The Privacy Rule’s minimum necessary standard limits PHI exposure to what a task requires. The Security Rule adds administrative, physical, and technical safeguards for ePHI, while the Breach Notification Rule governs the response to AI-related PHI incidents. A system needs more than a redaction step.

The technical safeguards in 45 CFR 164.312 establish five engineering obligations. Access control limits who can use ePHI, while person or entity authentication verifies identity before access. Audit controls record activity involving ePHI. Integrity controls protect against improper alteration, and transmission security protects data in transit. For the request pipeline, these translate into scoped credentials, verifiable caller identities, protected records of activity, and secure transport.

Contracts define the permitted data path as well. Every vendor that creates, receives, maintains, or transmits PHI on the organization’s behalf requires a signed BAA before receiving it, including inference, vector database, observability, and logging services. AI-specific terms should address training authorization, prompt and output retention, processing geography, incident notification, and model changes. The rules for routing and storage must follow these terms.

The HIPAA Security Rule NPRM published in January 2025 remains a proposal as of late 2026. It proposes removing the required/addressable distinction and introducing requirements including multi-factor authentication, encryption, vulnerability scanning, annual penetration testing, and written technology asset inventories. It is planning context.

Why the gateway is the only practical chokepoint for enforcing these controls

Application-layer enforcement divides the same obligation among services, agents, and RAG pipelines. Each version of these controls needs its own upkeep and audits. A gateway between applications and model providers is the only practical common chokepoint for governing those paths together, provided every relevant request passes through it. Routing, redaction, credentials, logging policy, and fallback restrictions can then be applied consistently across callers.

Sanitization removes PHI that the task does not require and replaces identifiers with tokens where possible. An allowlist then restricts PHI-bearing traffic to covered endpoints, including any fallback destination. On the return path, output filtering can combine regex and LLM-based detection to catch a model repeating sensitive information from context. Logging policy governs what the pipeline retains throughout.

This sequence also exposes a tension in auditing. Recording original and sanitized prompts creates PHI-bearing records, so those records need a deliberately governed audit store separate from ordinary diagnostic logs. Its gateway-level logging includes the original and masked prompts, toxicity scores, and the original and de-masked outputs. Provider retention controls do not eliminate responsibility for those audit records.

Self-hosted open-weight models change the external contracting boundary. Downloading a model file does not send prompts to its publisher, so the publisher does not enter the business associate chain through inference. The gateway still has access, logging, and data-handling controls to enforce.

The five PHI persistence surfaces the gateway must cover beyond the prompt itself

Request and response logs are the first surface. Full HTTP bodies sent to Datadog, Splunk, or CloudWatch can preserve PHI despite a zero data retention policy elsewhere, so operational logs should be limited to metadata such as timestamps, HTTP status codes, endpoint URIs, and user IDs.

The gateway must strip PHI-bearing logging metadata before export, rather than assuming that sanitizing the model request also sanitizes the trace.

Response caches introduce persistence through a performance feature. Semantic caching can save token costs, but cached responses containing PHI require their own retention, access control, and deletion policies.

RAG indexes and embeddings require explicit treatment too. PHI stored in a vector database remains ePHI, embedding vectors are not de-identified by default, and the database vendor needs its own BAA.

Fallback providers are the fifth surface to govern. Automatic failover to an uncovered provider creates an unauthorized disclosure, so the allowlist must constrain fallback chains as well as the primary destination.

These surfaces also require clear separation between audit and debugging data. Mixing structured audit events with diagnostic output makes the audit trail difficult to search. Keeping full prompts without a written retention and redaction policy creates another store of PHI. Placing AI audit records under ordinary application observability permissions leaves their access controls misaligned with their contents.

PHI can travel through direct prompts, retrieved RAG context, tool results, request logs and exports, and fallback routing to a provider without a BAA.

Provider selection and BAA coverage for hosted endpoints

A BAA covers specified services within a provider’s catalog. No LLM is “HIPAA certified.” The signed agreement must cover the endpoint, feature, and deployment path that will receive PHI. Late-2026 coverage illustrates why a provider-level allowlist alone is too broad.

Anthropic offers different enrollment paths for Claude Enterprise and its API. The organization’s Primary Owner can accept the Enterprise BAA directly, while Anthropic must enable a HIPAA-ready organization for API access. Feature exclusions remain decisive after that step. Batch, Files, Skills, Code Execution, and Web Fetch APIs are not covered, and data sent through connectors, MCP servers, or other third-party flows is not covered by Anthropic’s BAA.

Amazon Bedrock uses the AWS BAA accepted through AWS Artifact. Bedrock and Bedrock AgentCore appear on the HIPAA-eligible services list updated 15 October 2026. Only listed services may process PHI. Teams already operating under an AWS BAA can typically add Bedrock-hosted foundation-model inference without separate model-provider contracting.

Google Cloud renamed Vertex AI to Gemini Enterprise Agent Platform in April 2026. Its BAA is accepted through Google Cloud, and pre-GA offerings must not receive PHI. Model Garden models are covered when deployed to a Google-managed endpoint, while Anthropic-managed deployments and other non-Google-managed paths each need to be checked. Contracts that use the earlier service name should also be checked against the current covered-services list.

Agent features make these boundaries especially consequential in practice. Web fetch, code execution, file stores, and connectors can cross beyond the services an agreement covers. Gateway policy therefore needs endpoint- and feature-level permissions.

Access control and audit logging as gateway-enforced requirements, not application responsibilities

The gateway sees model calls across applications and agents, making it the shared enforcement point for model-layer access. RBAC must still operate at two levels. The data layer determines which patient records a user may access, while the model layer determines which models and prompts that user may invoke. Virtual keys or similarly scoped credentials let the gateway apply the latter restrictions uniformly.

Identity must remain attributable throughout the request path. SSO connects model access to the organization’s identity provider so directory-level revocation also removes model-layer access. Shared API keys defeat that attribution. Adding a new script or agent should not create a separate, weaker route around the same identity controls.

Audit events need a timestamp, accessor identity, action, and reference to the PHI accessed. Structured records generated for every inference call avoid reliance on manual correlation after an incident. They also need protection against alteration. A mutable log that pipeline operators can rewrite does not provide an integrity-protected audit trail, and a record of access need not reproduce the entire patient-bearing prompt.

The NPRM reinforces the direction toward stronger authentication, encryption, and documented evaluation of technical safeguards, although it remains a proposal. Those controls need demonstrable enforcement. The gateway is therefore not an add-on to the compliance program, but the enforcement surface for its request-pipeline technical safeguards.

What should teams look for in a HIPAA-compliant AI gateway?

Evaluation should follow the full PHI path. A managed gateway needs a BAA covering the actual deployment and features in use. A self-hosted or in-VPC gateway can keep the gateway vendor outside the PHI path, but transfers infrastructure responsibility to the team.

Redaction needs to run at the request level. Evaluation should establish whether the gateway supports reversible tokenization when applications need identifiers restored, and whether original and sanitized audit records can be governed separately. Provider allowlists must constrain fallback destinations as well as primary routes. Tool and agent coverage must extend those controls from direct inference to MCP calls and agent traffic.

Prompt-body logging should be disableable or redactable globally and per virtual key, with audit records separated from application observability data. SSO, SCIM, and per-user or per-application credentials support consistent access administration. A gateway that protects the model request but exports its contents into an uncontrolled trace leaves the central problem unresolved.

Operational capacity distinguishes otherwise legitimate deployment choices for buyers. A fully managed gateway removes deployment, patching, and scaling work, while a self-hosted open-source gateway in the organization’s VPC offers control at the cost of those responsibilities.

The eight foundations a complete HIPAA AI system must have — and the three most teams miss

A complete review needs eight foundations. The first five establish the familiar HIPAA baseline. Encryption must cover PHI at rest and in transit, including RAG indexes, embeddings, and audit logs. RBAC must limit access to the minimum necessary at both the data and model layers. Immutable audit logging must record PHI access, inference involving PHI, and outputs shown to users, and the records must be kept for at least six years.

The fourth foundation is a documented PHI flow map showing entry points, transformations, model-bound data, returned data, and response destinations. The fifth is signed BAA coverage for the vendors on that map that handle PHI. Contracts and architecture must describe the same system. A flow map that omits a logging service or fallback endpoint cannot support a complete review.

The three AI-specific foundations cover what ordinary application controls miss. The first is a retention and deletion policy covering provider-side prompt caches, embeddings, fine-tuning corpora, and logs, with a working path for patient deletion requests. The second is a breach-notification plan that covers prompt injection, training-data leakage, embedding inversion, and prompt-cache exposure by name. The third is a documented Security Risk Analysis under §164.308(a)(1)(ii)(A), refreshed when the AI architecture changes. None is a one-time gateway configuration task.

Engineering, security, and compliance leads can use these foundations to guide their review. The gateway enforces technical controls, but administrative and physical safeguards, risk analysis, and breach planning remain the covered entity’s responsibility. HIPAA readiness begins with an architecture that accounts for the AI-specific data path before launch.

Notes

  1. Are Chatbots Ready for Privacy-Sensitive Applications? An Investigation into Input Regurgitation and Prompt-Induced Sanitization

    Informed the discussion of PHI reappearing in model outputs and of sanitizing prompts and filtering outputs for repeated sensitive information.

Marcus Delacroix

← Back to PHI Casebook