Site icon Master of Code Global

HIPAA Compliant LLM: What Can Go Wrong and How to Secure PHI and Business Reputation

On October 17, 2026, Amazon’s honeypots logged an attempt to exploit a PHP bug that nobody had made public. PHP shipped the fix on October 21, four days later. Anhelina Biliak, our Application Security Leader, summed up the result on LinkedIn: an admin who patched within the hour was still four days late.

The bug has nothing to do with LLMs, but the lesson carries over. Attackers move faster than most compliance calendars, and health data is the costliest data to lose. IBM puts the average healthcare breach at $6.64 million in 2026, the highest among the industries.

A HIPAA compliant LLM is not just about a model you buy off a shelf. It is about building an LLM-powered product, such as a patient assistant or a documentation tool, so that every part touching protected health information (PHI) follows HIPAA. How much control you have over the model itself varies. But you do control the product around it: what data goes in, who can access it, what gets stored, and what the system is allowed to do.

This guide focuses on that product layer, which sits inside Generative AI in healthcare, where data rules are strictest.

A recent project in a regulated industry gave us a reason to write down how we already vet providers and limit what an LLM may do. Below, we cover that method, five healthcare projects, the threats we plan for, the controls we build, provider coverage, and cost with practical insights from our CTO, application security lead, project manager, and product AI lead.

If you are planning a healthcare AI product, book a call with our healthcare AI consulting team before you choose a provider.

Table of Contents

Key Takeaways

What Have We Learned Building AI Products for Healthcare?

HIPAA-Compliant AI Health Companion

The client was a US digital wellness platform serving 150+ employer-sponsored programs. It needed HIPAA compliance end to end, including encryption, role-based access control, and audit logging, plus reuse of its existing Excel knowledge bases without migration.

As part of our healthcare chatbot development work, we ran an eight-week proof of concept: one cardiovascular pathway, retrieval over the client’s own content, AWS HIPAA-eligible services, a penetration test with the client’s security team, and a 500-member pilot. Phase 2 took 16 weeks and added four clinical domains and a clinician moderation dashboard.

Intelligent Patient Triage System

A regional provider serving 2.3 million people in the Southwest handled 8,000+ inquiries a day. Patient volume had grown 42% in three years while staffing stayed flat, hold times averaged 12 minutes, and the phone system could not tell urgent medical calls from routine administrative ones.

We built a patient triage system that serves as the first point of contact. It asks about symptoms, history, and urgency using established clinical triage protocols, then routes the patient to scheduling, health information, or a clinician. Patients can also change appointments, request refills, verify insurance, and ask for medical records themselves, and the assistant connects to the EHR (Epic and Cerner) and scheduling software for real-time data.

Generative AI FAQ Assistant

A US healthcare provider with 70,000+ employees across four states needed answers on insurance, leave, and HR policy. We built an LLM-powered FAQ assistant on OpenAI o4-mini. The knowledge base was restructured by state policy and user role, so the assistant identifies the user’s location and answers from that state’s rules, and supervisors see different information than other employees.

AI-Powered Clinical Decision Support System

A clinic wanted to give frontline staff access to specialist expertise without a consultation on every case. We compared MedLM, GPT-4.5, and Gemini, built retrieval over authoritative guidelines, and developed a HIPAA compliance framework covering PHI handling, secure model interactions, and encryption standards. Controlled proof-of-concept testing showed 3x faster diagnostic decisions, and the case projects 300% ROI within 24 months.

PHI-Compliant Patient Engagement Program

For a major US healthcare company, we built a 60-day SMS program for patients with or at risk of diabetes. Patients opt in by text, an NLP engine answers questions across 120 intents, and live agents take over when it cannot. The client keeps sensitive data and sends only a first name, a phone number, and the first three letters of a medication. Deciding what never leaves your systems is the first step of the minimum necessary standard.

Conversational AI Provider Review Method

A client in a regulated industry asked us to scope an AI product in three stages with decision gates. For the provider review, we followed five rules that carry straight over to healthcare:

  1. Read each provider’s published policy and rule out those whose terms conflict with the use case, such as data residency limits, restrictions on health guidance, or, in healthcare, BAA scope.
  2. Keep the highest-risk provider away from anything near a transaction.
  3. Get written confirmation from the primary choice before relying on it.
  4. Test a US-hosted open-weights model as a fallback.
  5. Never let the AI execute a transaction. Conventional services handle cart, eligibility, and payment.

The same five rules carry over to a healthcare product. Provider review comes first, and the model never gets the last word on anything that touches PHI.

Why Is a HIPAA Compliant LLM Product Harder Than Signing a BAA?

What a HIPAA Compliant LLM Means in Practice

No AI model can be HIPAA certified by itself, because OCR does not endorse, certify, or recommend specific technology or products. What exists is a compliant product, where prompts, retrieval, storage, logs, staff access, and policies all meet the rules. Vendors call their services “HIPAA eligible” when they will sign a BAA and support the safeguards you must configure. HIPAA eligible vs HIPAA compliant is the gap between what a vendor offers and what you built. So when a vendor says “compliant”, ask which parts it covers.

Which HIPAA Rules Apply to LLM Products

HIPAA does not automatically apply to every healthcare or wellness app. Applicability depends on the organization’s role and how it handles health information. For products subject to HIPAA, three main rule sets apply:

  1. The Privacy Rule governs how you use and disclose PHI, including the minimum necessary standard where applicable. As a design principle, send the model only the PHI a task needs.
  2. The HIPAA Security Rule requires administrative, physical, and technical safeguards, such as access controls, audit controls, transmission security, and a risk analysis.
  3. The Breach Notification Rule sets your duties when something leaks.

You also need appropriate Business Associate Agreements (BAAs) with vendors acting as business associates and handling PHI for you.

For an LLM product, this has a practical meaning. A prompt with a patient’s name and symptoms is PHI. So are a retrieved chunk, a stored chat, and a log line. HHS has proposed tightening the Security Rule to require encryption at rest and in transit and multi-factor authentication, with limited exceptions.

Why a BAA and Certifications Fall Short

A BAA assigns responsibility and configures nothing. A vendor’s certifications cover the vendor’s infrastructure, while your product decides which PHI goes where. HHS is explicit that a cloud provider holding only encrypted data still counts as a business associate, and that you violate HIPAA by using one without a BAA. Neither point says your setup is sound. Google’s documentation makes the split plain: Google provides infrastructure controls, and you must configure and secure what you build.

Three Public Failures to Learn From

How to fix this problem: audit every data store your AI vendor holds, ask for evidence behind accuracy claims, and finish a risk analysis before launch.

Which Threats Do We Design Around on Every AI Build?

LLM Risks Specific to Healthcare Products

Healthcare products must address prompt injection, sensitive information disclosure, and excessive agency first. They are the top three risks in the OWASP Top 10 for LLM Applications 2026.

The evidence is concrete. In a JAMA Network Open study, simulated prompt injection succeeded in 94.4% of 108 medical dialogues. In the MCPTox benchmark, poisoned tool descriptions reached attack success rates of up to 72.8% across 20 agents. And 53% of organizations in a Cloud Security Alliance survey had AI agents exceed their intended permissions. Check our LLM security guide to learn about the classic threats in more detail.

Risks When AI Writes the Software

AI-generated code is untrusted code. Anhelina Biliak puts the rule that matters most for PHI this way:

“Enforce authorization before retrieving data or executing tools.”

The top risks in an AI-assisted SDLC are insecure generated code, invented packages that attackers turn into malicious ones, coding agents steered by hidden instructions, and model output passed unchecked into SQL or a shell. We handle them with a required threat model before any code is written, daily dependency triage, and engineer validation of every issue.

Vibe-coded prototypes carry the same risk. Dima Lukhanin, Senior Project Manager and Delivery Lead, keeps three rules for them: never use real production data, never share the app publicly without restriction because “a vibe-coded app hasn’t been through a security audit“, and never present it as finished. A prototype that touches real PHI breaks the first rule on day one.

Why Rules Belong in Code, Not Prompts

Bohdan Musiichuk, Product AI Lead, saw instructions work on a few examples and break across thousands of stores while building AI upsell funnels. His fix is domain-neutral: “Wherever a rule really matters, the system itself enforces it.” He keeps the model’s task narrow for the same reason: “The less room for imagination, the more stable the product.” For PHI, that means a hard filter on which records a model can see, not a polite request in the system prompt. A prompt can ask the model to ignore a patient’s record, but only an access check in code guarantees the record never reaches it.

The Shadow AI Problem

Employees connect agents to company data before anyone approves them. In healthcare, that can mean PHI flowing to a vendor with no BAA, which is the exact gap HIPAA penalizes. The fix is a registry of approved agents, with the AI gateway blocking anything not on it.

Bogdan Sergiienko, our CTO, states the control directly: “Any software should only be able to reach the information and functions required for its purpose.” Every agent needs an owner, scoped credentials, and an audit trail. If you want an outside check, our AI security consultants review architectures and agent permissions before they reach production.

How Do You Build Controls Into an LLM-Powered Healthcare Product?

Where PHI Lands and How to Control It

The model call is only one of nine places PHI lands. The other eight are the prompt, the uploaded file, the retrieved chunk, the embedding, the vector store, the conversation history, the log, and the cache. The generated output makes the ninth. Each one needs a control, and the OWASP 2026 risks map to them like this:

OWASP 2026 risk Control we build
Prompt injection Treat retrieved text as untrusted and limit which tools the model can call
Sensitive information disclosure Minimum necessary input, redaction, and output filters
Excessive agency Least privilege and human approval for writes
Vector and embedding weaknesses Permissions on the index and deletion with the source record
Hidden context exposure No PHI or secrets in system prompts
Improper output handling Validate output before any system acts on it

Handling PHI in Prompts, Files, and Outputs

Send the minimum necessary, filter before the model sees anything, and treat the output as untrusted. Strip or tokenize identifiers a task does not need, because minimizing sensitive data at the entry point reduces what downstream systems must protect. Check each uploaded document against the requesting user’s permissions. Validate responses before any system acts on them, and keep a human in the loop for clinical decisions. For API calls, use only endpoints your BAA covers, and turn on no training on PHI and zero data retention settings where the provider offers them.

Protecting Embeddings, Logs, and Caches

Treat every one of them as a PHI store. Embeddings are not anonymous: researchers recovered 92% of 32-token inputs exactly and pulled full names out of clinical notes. So apply encryption at rest and in transit to the vector database, use the same role-based access control you use on the source records, and set retention limits on chat history, logs, and caches. Delete embeddings when the source record is deleted, or a removed patient file keeps living in the index.

Safeguards: Encryption, Access, and Audit Logging

We recommend four core safeguards for every ePHI data flow. Use encryption at rest and in transit on every store and connection. Require multi-factor authentication for people and short-lived credentials for services and agents. Apply role-based access control with least privilege to data and tools. Keep audit logging on every PHI access, retrieval, and tool call, so you can reconstruct who saw what. Review the audit trail on a schedule, because an unread log protects nothing.

Choosing Between Cloud, Private, and Self-Hosted

A cloud API is the fastest path, a private cloud gives you more control, and self-hosted open-weights models give you the most control and the most work. A HIPAA compliant LLM API shifts infrastructure to the vendor, but you depend on its BAA scope.

Option Control over data Your workload Best fit
Cloud API Vendor policy and BAA Low Pilots, general tasks
Private cloud Your account, your keys Medium Sensitive workloads at scale
Self-hosted / open-weights Full High Strict residency or high volume

Our guide to on-premise AI vs cloud AI shows how to choose by workload. We usually recommend starting with a covered API and moving sensitive workloads inward as volume or risk grows.

Secure RAG and EHR Integration

Put an AI gateway between the model and the record system, then build retrieval on permissions. The gateway enforces authentication, redacts identifiers, logs each request, and blocks tools the user may not call. Then follow four rules from our enterprise RAG architecture work:

  1. Index each record with its access list, and filter by permission before ranking.
  2. Query the EHR or EMR through read-scoped service accounts, one per use case.
  3. Treat retrieved text as untrusted, since hidden instructions in a document can steer the model.
  4. Route write-back through a human or a conventional service, never straight from the model.

Need this layer built? Our LLM integration team designs and delivers EHR connectors, permission-aware retrieval, and audit trails. Book a call to scope it.

Which Providers Fit a HIPAA Compliant LLM Product?

Provider Coverage at a Glance

OpenAI, Anthropic, Microsoft, Google, and AWS all offer services that work as HIPAA compliant LLM providers once a BAA is in place. People search for HIPAA compliant LLM models, yet models change every few months, so choose providers by coverage and keep the model swappable behind your gateway.

Provider What the BAA covers Watch for
OpenAI API with Modified Retention, ChatGPT for Healthcare, ChatGPT Enterprise with Regulated Workspace Only listed products are eligible
Anthropic First-party Claude API and Claude Enterprise with HIPAA configuration Batch, Files, Skills, Code Execution, and Web Fetch are excluded
Microsoft BAA through the Data Protection Addendum for in-scope Azure services Confirm Azure OpenAI scope in the Azure HIPAA offering
Google Generative AI on Agent Platform (formerly Google Vertex AI) and Gemini Enterprise No pre-GA offerings with PHI
AWS AWS Bedrock is on the HIPAA eligible list Accept the BAA in AWS Artifact first

When You Need a BAA

You need a BAA whenever a vendor creates, receives, maintains, or transmits PHI for you. That includes the model provider, the cloud host, the vector database, the logging and monitoring tools, and any subcontractor that can see prompts or outputs. Encryption does not change this, because a vendor that cannot read the data is still a business associate. If the data never reaches a vendor, or it is properly de-identified first, no BAA is needed for that flow.

What to Verify Before You Choose

Verify six things in writing:

  1. What the BAA covers and excludes.
  2. How long the vendor retains prompts and outputs.
  3. Whether your data trains its models.
  4. Where data is stored.
  5. Which subprocessors can see it.
  6. How fast it notifies you of an incident.

Retention rules can change which HIPAA compliant LLM models you may use. Anthropic’s covered models, for instance, require 30-day retention unless Anthropic authorizes otherwise, while OpenAI’s API coverage depends on Modified Retention. Consumer chat tools usually fall outside these agreements, which is one of the ChatGPT security risks we see most often.

How Much Does It Take to Build and Keep an LLM Product Compliant?

Where LLM Products Pay Off First

Patient support and administrative automation deliver the clearest results today, and clinical documentation is next.

HIPAA compliance does not establish clinical safety or effectiveness. Depending on its intended use, a healthcare AI product may also be subject to FDA requirements.

What It Costs

A regulated or highly complex MVP typically costs $180K to $350K+ and takes 6 to 12+ months, according to our AI MVP cost guide. Estimated development and maintenance costs break down as follows, excluding usage-based infrastructure and third-party fees.

Larger rollouts cost more: from $750K to $1M upfront. Some costs depend on your volume and vendors, so we cannot put a range on them without scoping:

Implementation Path From Risk Analysis to Launch

Follow six steps:

Keeping It Compliant After Launch

Monitor, retest, and review on a schedule:

Not sure where your product stands? Tell us whether your data is not ready yet or you are ready to pilot, and we will meet you there. Our AI healthcare software development team takes you from risk analysis to production. Book a call with Master of Code Global.

FAQ

Can We Use ChatGPT, Claude, or Gemini With PHI?

Yes, but only through plans and configurations covered by a signed BAA. For OpenAI, that means the API with Modified Retention, ChatGPT for Healthcare, or ChatGPT Enterprise with a Regulated Workspace. For Anthropic, it means the Claude API and Claude Enterprise with HIPAA configuration. For Gemini, use Generative AI on Agent Platform or Gemini Enterprise under Google’s BAA. Consumer accounts are not on these lists, so do not put PHI into them. Ask each vendor for its current coverage list in writing.

Does De-Identification Make an LLM Safe to Use?

De-identification reduces risk but does not remove it. HHS recognizes two methods, Expert Determination and Safe Harbor, and Safe Harbor removes 18 identifier types. Automated redaction misses contextual details, and combined fields can re-identify a person. Properly de-identified data is no longer PHI, but treat redaction as one layer, with access controls and logging behind it. Test your redaction on real notes before you rely on de-identification.

Should We Buy an API, Self-Host, or Build Custom?

Start with a HIPAA compliant LLM API from a covered vendor if speed matters and your data flows are simple. Choose self-hosted or open-weights models when residency, volume, or control outweighs the operating burden. Build a custom product when you need EHR integration, permission-aware retrieval, and audit trails that off-the-shelf tools do not provide. Many teams combine all three. Price each option per conversation before you commit, including retention and fallback costs.

Talk to our AI Strategists
Exit mobile version