NORTHELL
SYSTEMS OPERATIONAL Start a project →
AI & Automation

HIPAA-Compliant AI: How to Add an LLM to a Healthcare App Step by Step

No model is HIPAA compliant on its own. A step-by-step guide to BAAs, eligible API features, de-identification, logging and data flows for healthcare AI.

X / Twitter LinkedIn
HIPAA-Compliant AI: How to Add an LLM to a Healthcare App Step by Step
TL;DR

No language model is HIPAA compliant by itself. Compliance is a property of your whole system: a signed business associate agreement with every vendor that touches PHI, using only the API features that agreement covers, sending the model the minimum data it needs, and keeping PHI out of logs, traces and analytics. Anthropic, OpenAI and AWS Bedrock all offer a BAA path today, but each one excludes specific features, so the eligible-features list matters as much as the contract.

KEY TAKEAWAYS
  • Ask whether PHI needs to reach the model at all. Many useful AI features work on de-identified or non-patient data and avoid most of the compliance load.
  • Every hop that stores or processes PHI needs a BAA, including model APIs, vector databases, observability tools and error trackers. HHS says lacking the encryption key does not exempt a cloud provider from business associate status.
  • A BAA covers named features, not the whole platform. Anthropic's, for example, excludes its Batch API, Files API, code execution and web fetch for HIPAA-ready API organizations.
  • Redaction is not automatically de-identification. HHS Safe Harbor requires removing 18 identifier categories wherever they appear, including free text.
  • Logs and evaluation datasets are where PHI most often leaks in AI products. Design them to use tokenized IDs from day one.
  • If you are a covered entity using AI in patient care decisions, 45 CFR 92.210 adds a duty to identify and mitigate discrimination risk.
In This Article
  1. Step 1: Decide whether PHI needs to reach the model at all
  2. Step 2: Map every hop PHI will touch
  3. Step 3: Choose a model provider path and read the eligible-features list
  4. Step 4: De-identify where you can, and be honest about what that means
  5. Step 5: Build prompts on the minimum necessary data
  6. Step 6: Keep PHI out of logs, traces and evals
  7. Step 7: Design for clinical risk, not just privacy
  8. Step 8: Test the boundary before launch
  9. What this means for budget and timeline
  10. How Northell can help

Most healthcare product teams start with the same question: is this model HIPAA compliant? It is the wrong question, and the answer is always no. HIPAA does not certify software. It sets obligations for covered entities and the business associates that handle protected health information (PHI) on their behalf. A model API can be part of a compliant system, or part of a breach. Which one depends on contracts, configuration and design decisions that sit almost entirely with you.

This guide walks through those decisions in the order we would make them when adding a language model to a patient portal, a clinician tool or a care-coordination app. It is written for founders, CTOs and product leads, not lawyers, so treat it as an engineering checklist to bring to your compliance counsel, not a substitute for them.

Step 1: Decide whether PHI needs to reach the model at all

The cheapest compliance work is the work you avoid. Before choosing a vendor, sort every planned AI feature into one of three tiers.

TierWhat the model seesExamplesCompliance load
1. No patient dataPublic or internal content onlyDrafting patient education leaflets for clinician review, internal policy search, summarising published guidelinesLow. Normal vendor security review, no PHI controls needed if you enforce the boundary.
2. De-identified dataData that meets a HIPAA de-identification standardPopulation analytics, operational reporting, model evaluation on de-identified casesMedium. The hard part is proving the data is really de-identified.
3. Identifiable PHIIndividual records, notes, messages, imagesVisit summaries, inbox triage, prior authorisation drafts, intake chatHigh. BAAs across the chain, minimum-necessary design, audit logging, review workflows.

Our opinion: plenty of teams jump straight to tier 3 because the demo is impressive, then spend months on controls before learning whether anyone uses the feature. If a tier 1 feature can prove the value of AI in your product, ship it first. When you do move to tier 3, pick one workflow with a clear owner on the clinical side, not five.

Also be honest about scope. HIPAA applies to covered entities (health plans, clearinghouses and most providers) and their business associates. A purely consumer wellness app may sit outside it, though FTC and state health privacy rules can still apply. If you sell to providers or payers, assume HIPAA applies.

Step 2: Map every hop PHI will touch

An AI feature has more moving parts than a typical CRUD screen, and each one is a place PHI can land. Draw the data flow before you write code. A realistic tier 3 feature looks something like this:

  1. The client app sends a request (for example, "summarise this patient's last three visits").
  2. Your backend fetches records from the EHR or your own database.
  3. A retrieval layer pulls relevant chunks from a vector database or search index.
  4. A prompt is assembled and sent, possibly through an LLM gateway or proxy, to the model provider.
  5. The response is post-processed, shown to the user and maybe written back to the record.
  6. Along the way, logs, traces, error reports, analytics events and evaluation datasets capture some or all of the above.

Every vendor in that chain that creates, receives, maintains or transmits PHI needs a business associate agreement. Encryption does not get you out of it. The HHS Office for Civil Rights says a cloud service provider is a business associate "even if the CSP processes or stores only encrypted ePHI and lacks an encryption key for the data". The same guidance notes that business associates are directly liable for safeguarding ePHI under the Security Rule and for reporting breaches.

The hops teams forget are rarely the model API. They are the vector database hosted on a startup plan without a BAA, the LLM observability tool that stores full prompts, the error tracker that captures request bodies, and the product analytics script that records what users typed. Put each one in a table with three columns: does it see PHI, is there a signed BAA, and what is its retention period. Any row with "yes, no" is a blocker.

Step 3: Choose a model provider path and read the eligible-features list

Major providers now offer BAAs, but each agreement covers named services and features. The contract and the feature list have to be read together. Here is what the three most common paths say today, based on their own documentation. These are vendor statements and they change, so re-check them before you sign.

PathBAA availableNotable limits stated by the vendor
Anthropic first-party APIYes, for HIPAA-ready organizations (Anthropic privacy center)Messages API covered, including prompt caching and structured outputs. Batch API, Files API, Skills API, code execution and web fetch are listed as not covered and not accessible. Data sent to third parties via external MCP is not covered. Covered Models require 30-day retention and are unavailable with zero data retention unless expressly authorized. Several Messages API features are covered only under BAA versions accepted after 1 April 2026.
OpenAI APIYes, for API healthcare customers (OpenAI business data page)Eligible organizations accept the standard BAA in the API Platform (OpenAI help center). OpenAI points customers to a separate list of HIPAA-eligible products and configuration requirements before processing PHI. Qualifying organizations can configure retention, including zero data retention.
Amazon BedrockYes, under the AWS BAA (AWS HIPAA eligible services)Bedrock is on AWS's HIPAA eligible services list. AWS requires a signed BAA before using eligible services with PHI and states that customers must configure services consistent with HIPAA under a shared responsibility model.

Three practical consequences follow. First, the feature list shapes your architecture. If a provider excludes its batch endpoint, your nightly summarisation job runs through the synchronous API and costs more; if it excludes file uploads, documents go into the prompt as text. Second, agentic features deserve extra care: a tool that fetches web pages or calls a third-party MCP server can move PHI outside the BAA boundary even when the model call itself is covered. Third, the date you signed matters. A BAA accepted two years ago may not cover features added since.

Which path should you choose? If your infrastructure and other BAAs already live on AWS, Bedrock keeps the vendor list short. If you need a specific model or feature that is only available first-party, sign directly with that provider. Either way, choose based on the eligible features you actually need, not on benchmark scores.

RELATED SERVICE

Working on something like this? See our Claude Agent Development →

Step 4: De-identify where you can, and be honest about what that means

De-identification is the main way to keep data out of tier 3, but it is frequently overclaimed. HHS recognises two methods:

  • Safe Harbor. Remove 18 categories of identifiers and have no actual knowledge that the remaining information could identify the person. The list goes well beyond names and SSNs: all elements of dates except the year, geographic units smaller than a state, phone and fax numbers, emails, medical record and account numbers, device identifiers, URLs, IP addresses, biometric identifiers, full-face photos and "any other unique identifying number, characteristic, or code".
  • Expert Determination. A qualified expert applies statistical or scientific methods and documents that the risk of re-identification is very small for the intended use.

The trap for AI products is unstructured text. HHS is explicit that the standard makes no distinction between structured fields and free text: an identifier must be removed wherever it appears. A clinical note that says "patient's daughter, a nurse at the county hospital, visited on the 14th" contains a date element and potentially identifying details that a name-and-SSN redactor will miss.

So use automated redaction as a risk-reduction layer, not as a compliance claim. Pre-model redaction is still worth doing in tier 3, because it lowers the impact if something goes wrong downstream. But unless you have followed one of the two HHS methods and documented it, treat the output as PHI and keep it inside the BAA boundary.

Step 5: Build prompts on the minimum necessary data

HIPAA's minimum necessary principle maps neatly onto good prompt engineering: send the model only what the task requires. In practice that means a few concrete design rules.

  • Assemble context on the server. The client sends an intent and an encounter reference, never a raw record. Your backend decides which fields go into the prompt.
  • Scope retrieval to the patient and the user. A vector index that mixes all patients is a cross-patient disclosure waiting to happen. Filter by patient and by the requesting user's permissions before similarity search, not after.
  • Strip what the task does not need. A medication reconciliation prompt does not need the patient's address or insurance ID. Drop those fields before the prompt is built.
  • Constrain outputs. Use structured outputs where your provider's BAA covers them, so the model returns fields your code validates rather than free text that may echo extra identifiers.
  • Treat the model as a user with limited rights. If the model can call tools, give it read-only, patient-scoped tools and log every call. Prompt injection inside a patient message should never be able to fetch another patient's chart.

Step 6: Keep PHI out of logs, traces and evals

This is where we would spend the most review time. AI products generate far more telemetry than traditional apps, because teams need to inspect prompts and outputs to improve quality. That telemetry is full of PHI by default.

  1. Use tokenized references in general-purpose logs. Log a request ID, a pseudonymous patient or encounter token, user role, prompt version, model, latency, token counts and the reviewer's decision. Not the note text.
  2. Keep full prompts and responses in one controlled store, if at all. It should be covered by a BAA, access-controlled by role, audit-logged and subject to a written retention period.
  3. Scrub error trackers and analytics. Disable request body capture, mask input fields in session replay and check that no AI response text is sent as an analytics event property.
  4. Build evaluation sets from synthetic or properly de-identified cases. Copying a hundred real conversations into a spreadsheet for prompt testing is a disclosure. Synthetic cases written by clinicians, plus a small, access-controlled set of real cases inside your covered environment, is a safer pattern.
  5. Check your gateway. If you route traffic through an LLM proxy for cost tracking or failover, it sees every prompt. It needs the same treatment as the model provider.

Step 7: Design for clinical risk, not just privacy

HIPAA is about privacy and security. It says nothing about whether an AI summary left out an allergy. That risk sits with product design, and in some cases with other regulation.

If you are a covered entity under Section 1557 of the Affordable Care Act and you use AI to support patient care decisions, 45 CFR 92.210 applies. It prohibits discrimination on the basis of race, color, national origin, sex, age or disability through patient care decision support tools, creates an ongoing duty to make reasonable efforts to identify tools that use those variables, and requires reasonable efforts to mitigate the resulting discrimination risk. That is an inventory and governance task, and it is much easier if each AI feature is documented from the start.

On the product side, the patterns that work are the same ones we described in our guide to designing UX for AI features users trust: show the source records behind every generated statement, make the clinician's accept, edit or reject decision explicit, never write AI output into the chart without a human action, and design the failure state as carefully as the success state. Clinicians will forgive a tool that says "I could not find a medication list" much faster than one that invents one.

Step 8: Test the boundary before launch

Before any real PHI flows, run a short, deliberate test cycle focused on the edges rather than the happy path.

TestWhat you are checkingPass condition
Data flow auditEvery service that received test PHIEach one has a signed BAA and a known retention period
Feature allow-listCalls to provider features outside the BAABlocked in code or rejected by the provider, never silently allowed
Cross-patient retrievalPrompts that ask about other patientsRetrieval returns nothing outside the current patient and user scope
Prompt injectionInstructions hidden in patient messages or documentsTools cannot be steered to fetch or send data outside scope
Telemetry scanLogs, traces, error reports and analytics after a test runNo clinical text or direct identifiers outside the controlled store
Clinical reviewA clinician-written set of hard casesKnown failure modes are documented and shown in the UI

Then confirm the operational pieces: who reviews flagged outputs, how a suspected disclosure is escalated, and how your incident process connects to breach notification obligations under your BAAs. None of this is AI-specific, but AI features change the inventory of systems the process has to cover.

What this means for budget and timeline

We will not quote a number here, because it depends far more on your existing stack than on the AI feature. A team that already runs on a HIPAA-configured cloud with BAAs, audit logging and a working security review will add an LLM feature with modest extra effort. A team that has never mapped its PHI flows will find that the AI feature forces that work, and the compliance groundwork can take longer than the feature itself.

Two things reliably keep cost down. Start with a tier 1 or tier 2 feature to prove value. And make the boundary decisions in Step 2 and Step 6 before the first prototype, because retrofitting logging and retrieval scoping into a working demo is slower than building them in.

How Northell can help

Northell designs and builds healthcare software and AI features for product teams that need them to hold up in production. If you are planning an LLM feature for a healthcare product and want a second opinion on the data flow, feature scope or UX before you commit, get in touch. We are happy to start with a short review of what you already have.

Northell Team

Part of Northell's engineering and content team — the people who build production software, AI systems, and fintech infrastructure, and write about what actually works.

Frequently Asked Questions

Is ChatGPT or Claude HIPAA compliant?

Not as a blanket statement. OpenAI says it offers a business associate agreement to ChatGPT for Healthcare and API healthcare customers, and Anthropic offers a BAA for its first-party API, Claude in Microsoft Foundry and HIPAA-ready Enterprise plans. Both limit coverage to specific products and features, and both require configuration on your side. Consumer plans are not covered. Whether your use is compliant depends on the agreement you signed, the features you call and how your own system handles PHI.

Do we need a BAA if we strip names before sending data to the model?

Usually yes. Removing names is not de-identification under HIPAA. The Safe Harbor method requires removing 18 categories of identifiers, including most dates, geographic units smaller than a state, record numbers and any other unique code, wherever they appear in the record, and you must have no actual knowledge that what remains could identify someone. Clinical notes rarely meet that bar after simple redaction. If you cannot show the data is de-identified, treat it as PHI and put a BAA in place.

Can we use zero data retention instead of a BAA?

Zero data retention reduces exposure, but it does not replace a BAA. HHS guidance says a cloud provider that processes or stores ePHI is a business associate even if it only sees encrypted data and lacks the key. There are also vendor-specific interactions: Anthropic states that its Covered Models require 30-day data retention and are not available with ZDR unless expressly authorized, so check how retention and BAA coverage work together for the exact models you plan to use.

Which AI features are lowest risk to build first in a healthcare app?

Features that never see patient data: drafting patient education content reviewed by clinicians, internal policy search, scheduling copy, or summarising public clinical guidelines. Next come features on de-identified data, such as analytics over properly de-identified datasets. Features that read individual records, such as visit summaries or inbox triage, carry the most compliance work and should come after the data flow, logging and review processes are proven.

Does HIPAA cover a wellness or fitness app that uses AI?

HIPAA applies to covered entities (health plans, clearinghouses and most providers) and their business associates. A direct-to-consumer wellness app that is not acting for a covered entity may fall outside HIPAA, though other laws, such as FTC rules and state health privacy laws, can still apply. If your app is sold to or operates on behalf of a provider or health plan, assume HIPAA applies and get legal advice on your specific setup.

What should we log for an AI feature that handles PHI?

Log what you need for audit and debugging without copying clinical content into general-purpose tools: a request ID, a tokenized patient or encounter reference, user and role, model and prompt version, feature name, latency, token counts, and whether a human accepted, edited or rejected the output. Keep full prompts and responses, if you keep them at all, in a store that is covered by your BAAs, access-controlled and subject to a defined retention period.

GET STARTED

Need Engineers Who Ship This, Not Slides?

Tell us what you're building. A senior engineer replies within one business day with an honest read on scope, timeline, and fit — no sales rep in between.

Get a free scoping call

BONUS Book before the end of the month and we'll include a free build-vs-buy cost model for your specific project — no obligation, yours to keep either way.

We reply within one business day. No spam, no obligation.