Healthcare is one of the most promising places for language models: clinical note drafting, discharge summaries, prior authorisation letters, patient message replies, coding support and searching long records. It's also where a careless integration does the most damage. Sending a patient's history to an AI API is a disclosure of health data, with legal consequences in every major market.
This guide explains how to use LLMs with patient data under HIPAA in the US and the DPDP Act in India, and the architecture that makes it safe.
Last reviewed: 21 November 2026. Engineering guidance, not legal or medical-regulatory advice.
The legal picture
United States: HIPAA
If you're a covered entity or a business associate (see our HIPAA development guide), sending PHI to an LLM provider makes that provider your business associate or subcontractor. You need:
- a business associate agreement (BAA) with the provider, covering the specific service you use
- the provider's service configured as the BAA requires, which often means approved endpoints and zero or limited data retention
- the minimum necessary PHI for the task
Consumer chat apps generally aren't covered by a BAA. Staff pasting patient details into a personal AI account is a disclosure your organisation must prevent.
The major platforms offer BAA-covered options for their AI services, including enterprise and API offerings from model providers and AI services on AWS, Azure and Google Cloud. Coverage is specific to services and configurations, and changes over time. Get the current list from each provider, and keep a copy with your compliance records.
India: DPDP Act
India has no HIPAA equivalent. Health data falls under the DPDP Act and Rules, with most duties applying from 13 May 2027:
- you need a lawful basis: consent with a clear notice, or a specified legitimate use. Medical treatment during an emergency is one such use
- the LLM provider is your Data Processor, so you need a contract with security, retention and erasure terms
- reasonable security safeguards and breach reporting apply to the AI pipeline like any other system
- data can go abroad unless the government restricts the destination, but hospitals, insurers and government health schemes often require Indian hosting by contract
- if you're connected to ABDM, health records exchanged through it follow its consent framework (see our ABDM integration guide)
CERT-In's November 2026 AI security guidelines add expectations for AI systems: incident reporting within 6 hours, at least 180 days of security logs, and traceable models, prompts and configurations.
Medical device rules
If your AI feature diagnoses, treats or recommends treatment for individual patients, it may be software as a medical device: under the FDA in the US, CDSCO in India, and the EU MDR (with the EU AI Act on top). Drafting a note a clinician signs is very different from suggesting a diagnosis. Decide the intended use early, and keep the product within it.
Architecture: a safe pattern
Clinician app ──► AI gateway (your service, in your cloud)
├─ auth + purpose check (who, which patient, why)
├─ minimise + redact (strip identifiers not needed)
├─ retrieve context (from your records, permission-filtered)
├─ call model (BAA-covered / processor-contracted, approved region, no retention)
├─ guardrails (output checks, citations, safety rules)
└─ audit log (inputs refs, model, version, output, reviewer)
◄── draft returned for human review
1. One AI gateway
Never let apps call model APIs directly. Put every call through one internal service that enforces the rules below. You get one place to change providers, one audit trail and one set of controls.
2. Check the purpose and permissions
Before building a prompt, confirm that the user is allowed to see this patient's data, and that the task is an approved purpose. Retrieval must apply the same access rules as the rest of the application. A model must never see records the clinician couldn't open themselves.
3. Minimise and redact
Send only what the task needs:
- drafting a discharge summary needs the encounter's clinical details, but often not the patient's address, phone number or ID numbers
- replace direct identifiers with placeholders before sending (
[PATIENT],[DOB]), and put them back in the output inside your system - for analytics, coding suggestions and model evaluation, use de-identified data (HIPAA Safe Harbor or Expert Determination)
Redaction lowers the risk. It doesn't remove the need for a BAA or processor contract, because clinical text can identify people in ways a simple filter misses.
4. Choose the model endpoint carefully
- only use covered services (BAA in the US, processor contract under DPDP) in the right region
- turn on zero data retention or the shortest retention available, and make sure inputs aren't used for training
- for strict requirements, consider open models hosted in your own cloud account, which keeps all data inside your environment
- record the model name and version used for every output
5. Guardrails on output
- ground outputs in the patient's record, with citations to the source notes or results, so reviewers can check them
- check for hallucinated medications, doses and results against structured data where possible
- block or flag unsafe content, such as dosing advice in patient-facing messages
- keep a human in the loop: drafts are reviewed and signed by a clinician before they enter the record or reach the patient
6. Audit everything
For every AI action, log:
- who requested it, for which patient and for what purpose
- references to the input data (record IDs rather than copies of PHI, where possible)
- the model and prompt version
- the output, and whether the clinician accepted, edited or rejected it
This log supports HIPAA audit controls, DPDP accountability, CERT-In traceability and, just as importantly, quality improvement. The edit rate tells you where the model is weak.
7. Evaluate before and after launch
Build an evaluation set of de-identified real cases with the expected output, and test every prompt or model change against it. Track accuracy, omissions, hallucinations and safety issues, and have clinicians review a sample regularly. The approach is the same as for any LLM feature in production, with higher stakes.
Patient-facing AI
Chatbots and messaging assistants that talk to patients need extra care:
- tell patients clearly that they're talking to AI (the EU AI Act requires this; see Article 50)
- route urgent or clinical symptoms to humans or emergency guidance immediately
- don't give diagnoses or change treatment plans
- keep transcripts as part of the record where appropriate, with the same protections
Ambient scribes
AI scribes that record and transcribe consultations raise extra issues:
- get patient consent to record, and make opting out easy
- process audio in covered, regional services; delete audio once transcription is verified, unless policy requires keeping it
- keep the clinician's review and sign-off before notes are filed
Checklist
- Decide which law applies: HIPAA, DPDP, both or others
- BAA (US) or processor contract (India) with every AI provider that receives patient data
- Only covered services, approved regions and zero or minimal retention; no training on inputs
- One AI gateway for every model call
- Purpose and permission checks; retrieval filtered by the user's access
- Minimisation and redaction before calls; de-identified data for analytics and evaluation
- Grounded outputs with citations; checks against structured data
- Clinician review and sign-off before anything enters the record or reaches patients
- Audit log of requester, patient, purpose, model, prompt version, output and review outcome
- Evaluation set and regular clinician review of samples
- Intended use checked against medical device rules
- Policy blocking staff use of consumer AI tools with patient data
- AI included in incident response and CERT-In reporting scope
We design and build healthcare AI features, from clinical documentation to patient messaging, for MedTech teams, with gateways, guardrails and audit trails built by our data and AI team. If you're planning an AI feature that touches patient data, let's design it safely from the start.