Self-hosted LiteLLM for HIPAA: PHI in prompts and logs

A self-hosted LiteLLM gateway can limit where PHI is stored and record administrative changes, but it does not make an organization HIPAA compliant. This page maps the Security Rule duties to LiteLLM settings, evidence and remaining gaps.

On this page

Self-hosted LiteLLM for HIPAA: what the gateway can and cannot cover

A covered entity or business associate that runs AI features where prompts may carry electronic protected health information (ePHI) gets specific technical support from a self-hosted LiteLLM gateway, but the HIPAA Security Rule program itself stays with the organization. The Security Rule (45 CFR Part 164 Subpart C) applies to covered entities (health plans, health care clearinghouses and covered health care providers) and to their business associates, for all ePHI they create, receive, maintain or transmit (45 CFR 164.302). LiteLLM can help with audit controls, access restriction, prompt-body handling and log settings. It cannot decide your risk analysis, workforce policies, business associate contracts, sanctions or incident response, and those decisions need owners inside your organization.

There is no HIPAA certification. HHS states that no Security Rule standard requires an entity to certify compliance, and that private certifications do not prevent HHS from later finding a violation (HHS FAQ 2003). Any vendor or consultant who offers a HIPAA certificate for a gateway or its configuration is describing something HHS does not recognize. DeployOpen prepares the configuration, the control mapping and the evidence your compliance and security teams need to review, but it does not issue audit reports, attestations or certifications. For a gateway that handles ePHI, the review you should plan for is internal risk analysis plus whatever assurance your contracts or customers request, and you should confirm with counsel which of those apply to you.

Before you enable prompt storage or connect any model provider, confirm which provider relationships require a business associate agreement, and confirm that the agreement flows the Security Rule terms down to subcontractors that handle ePHI (45 CFR 164.314(a)(2)(i)). Ask your legal team whether the self-hosted deployment changes which parties are business associates. Treat the LiteLLM settings in this topic as technical safeguards that support your documented program, and record in your Security Rule documentation which requirements each one addresses and who owns it.

Which HIPAA Security Rule requirements map to LiteLLM settings

This table pairs each HIPAA Security Rule requirement that touches a LiteLLM gateway with the setting that supports it and the decisions that stay with the covered entity or business associate. Read each row as a starting configuration to verify, not as proof of compliance. The main takeaway is that the gateway supplies logging, masking and access controls, while risk analysis, policy, workforce decisions and contract terms remain with your organization.

RequirementLiteLLM configurationWhat the platform does not decide
Audit controls (45 CFR 164.312(b))Keep store_prompts_in_spend_logs off so prompt bodies are not written to spend logs. Enable admin audit logs (Enterprise) and review key and model change records.Which activity must be reviewed, how often, and who examines the records. Confirm with your vendor which events the audit log captures.
Unique user identification (164.312(a)(2)(i), required)Use SSO for the admin UI and assign each person a named identity. Confirm whether SSO beyond five users and team RBAC require Enterprise for your version.Identity lifecycle, joiner and leaver process, and the identity provider's own controls.
Automatic logoff (164.312(a)(2)(iii), addressable)Set short session and key lifetimes where supported. Confirm the admin UI idle timeout and token expiry settings for your release.Whether logoff is reasonable for each workstation, and any documented alternative if it is not.
Documentation retention (164.316(b)(2)(i))Keep Security Rule documentation, gateway configuration exports and key policy records for six years from creation or last effective date.Retention of prompt data and spend logs is a separate decision, set by your own policy and minimum-necessary analysis.
Business associate terms (164.314(a)(2)(i))Where a vendor or hosting partner handles ePHI, the contract must require Security Rule compliance and incident reporting. The gateway does not create these terms.Contract negotiation, subcontractor flow-down and incident notification duties are owned by the parties to the agreement.
PHI masking before model callsDeploy the Presidio guardrail in pre_call mode for masking, or logging_only mode to mask logs while keeping prompts intact. Test with representative ePHI samples.Detection accuracy. Masking does not guarantee every identifier is removed, so testing and residual-risk review remain yours.
Access limits per key and teamUse virtual keys with model restrictions and budgets so each application reaches only approved models. Team RBAC is an Enterprise feature to confirm for your edition.Which users need which models, and whether a given workload is permitted to receive ePHI at all.

How PHI travels through prompts, spend logs and provider calls

The first question a covered entity or business associate should answer is where a prompt body can be written as it moves through the gateway. The path runs from the application to the LiteLLM proxy, from the proxy to the model provider, and back again. Each hop is a place where ePHI could be copied, so the team should map every write point before any clinical workload goes live. By default LiteLLM does not store request and response content in its logs. Prompt bodies reach the spend logs only if store_prompts_in_spend_logs is enabled, so that switch is the first setting to verify in the deployed configuration and in any infrastructure-as-code that renders it. Confirm the setting against the LiteLLM logging documentation for the exact release you run, because log behavior changes between versions.

The second control is the Presidio guardrail. LiteLLM's Presidio integration masks or blocks PII and PHI and can run in pre_call, during_call, post_call, logging_only or pre_mcp_call modes, using separately deployed Presidio Analyzer and Anonymizer containers. A pre-call mode masks text before it leaves your network, which reduces what the provider receives. A logging-only mode protects the stored record but does not change the request sent to the model. Choose the mode per workload, and decide whether a block or a mask is the right outcome for each identifier type. Recognizers for clinical identifiers such as medical record numbers may need custom patterns, so test them against sample data that resembles your records.

Masking reduces exposure, but it is a control to test, not proof that no PHI is stored. Detection is probabilistic, free text contains names and dates in unpredictable forms, and a missed entity can pass through to a provider or into a log, including logs written by an upstream application before the call. Build a test plan that sends known synthetic PHI through every route, then inspects the provider request, the spend log row, the Presidio containers and any observability sinks. Record the results as evidence. Under the Security Rule, the covered entity still decides whether its log and retention design is reasonable and appropriate, so the test results and the reasoning behind them belong in the risk analysis.

Where PHI can and cannot persist in a self-hosted LiteLLM gateway

The diagram starts at the client application, which sends prompts to the LiteLLM proxy inside the covered entity's trust boundary. Before the request leaves, the proxy can call the Presidio Analyzer and Anonymizer containers, and the store_prompts_in_spend_logs switch decides whether prompt bodies reach the PostgreSQL spend logs. The audit log path records key and model changes separately. Check each hand-off in your own environment, including what the provider boundary receives and where logs are retained.

Configuration view for your own environment; confirm each switch and log store before go-live.

Evidence a HIPAA reviewer can check for the LiteLLM gateway

A HIPAA reviewer will ask for evidence, not descriptions. The cards below list the records a self-hosted LiteLLM gateway should produce for a prompt path that may carry ePHI, how each record is kept, and who on the covered entity or business associate side should review it. Several items depend on your own configuration and contracts, so confirm each one in your environment before the review.

Admin and key change audit records

Audit records should show who created, changed or deleted virtual keys, budgets, model access and team settings, and when. Under 45 CFR 164.312(b), the covered entity needs mechanisms that record and examine activity in systems that use ePHI, so export these records to your central log store and confirm they are complete for a sample of changes. Security operations staff should review them on a set schedule, and access reviewers should compare them with approved requests. Confirm with your deployment team which admin actions are captured in the Enterprise audit log and which need a separate source.

Audit control text

Spend log configuration showing prompts are off

Prompt bodies are not stored in logs by default, so the evidence is a configuration file and a sample of spend log rows showing no request or response content. Keep the proxy configuration under version control, record the value of the prompt storage setting for each release, and alert when it changes. A reviewer should see that the setting is off, plus a test request whose content does not appear in the database or log sink. Any team that opts in to prompt storage should have a documented reason and a separate approval.

LiteLLM logging docs

Presidio guardrail configuration and test results

If Presidio masks PHI before prompts reach a model provider, keep the guardrail configuration, the mode it runs in (such as pre_call or logging_only), and the list of entity types it covers. Test results matter more than the configuration: run a set of synthetic records with names, dates, medical record numbers and other identifiers, then keep the inputs, expected masks and actual outputs. Privacy and security staff should review failed cases and decide whether to add patterns. Label the test data as synthetic in every record, and do not use real patient data for testing.

Presidio masking docs

SSO and disabled shared logins

Reviewers will check that every human user signs in through the organization's identity provider and that no shared admin account remains active. Confirm that the admin UI uses SSO, record the identity provider configuration, and export a list of accounts showing that shared or default logins are disabled or removed. Note that SSO for the admin UI is free for up to 5 users from v1.76.0, and SCIM and audit logs require an Enterprise license, so check the license record. Access reviewers should compare this list with the current staff roster each quarter.

Admin UI SSO docs

Retention settings and six-year documentation

Two retention clocks apply. Log retention is set by your own policy and the log store configuration, so record the setting and the deletion job that enforces it. Security Rule documentation, including policies, configuration decisions and risk analyses for this gateway, must be kept for six years from creation or from the date last in effect, whichever is later, under 45 CFR 164.316(b)(2)(i). Store these documents in a system with its own retention control, and confirm with legal counsel how the log retention period fits your obligations.

Documentation retention
6 years
Documentation standard text

Business associate agreement status with model providers

Each model provider that receives PHI, and any hosting or log vendor that touches it, needs a business associate agreement that requires Security Rule compliance, flows the same terms to subcontractors, and requires reporting of security incidents under 45 CFR 164.314(a)(2)(i). Keep a register listing each provider, whether it signed, the contract date, and which data types it may receive. Procurement and legal teams should review the register before any new model route goes live. Whether a given provider offers a business associate agreement is a fact to confirm with that provider directly.

Organizational requirements text

Retention periods that apply to LiteLLM logs and documentation

The Security Rule requires written policies, procedures and the records of actions, activities and assessments that the rule calls for. Under 45 CFR 164.316(b)(2)(i), that documentation must be kept for six years from the date of its creation or the date it was last in effect, whichever is later. For a LiteLLM gateway, this covers the risk analysis, the configuration baseline, change approvals for key and model settings, and the policies on prompt storage and log review. The six-year clock is set by the rule, so the retention decision here is about keeping each version and its effective date, not about choosing a period.

  • Policies and procedures: keep each version of the gateway access, logging and retention policy with its effective date.
  • Risk analysis and assessments: retain the analysis that justifies the prompt storage and masking settings.
  • Configuration baselines: store the reviewed config.yaml and deployment manifests that were in effect for each period.
  • Review evidence: keep records showing that periodic reviews of the gateway settings took place.
  • Superseded versions: do not delete an older version until six years after it stopped being in effect.

Confirm with your compliance lead how these records are stored, indexed and made retrievable for an OCR complaint or audit.

What the LiteLLM gateway does not cover for HIPAA

The gateway controls the prompt path, but HIPAA places many duties on the covered entity or business associate that operates it. The cards below name the gaps that a LiteLLM deployment does not close on its own, and what to confirm before any ePHI reaches it.

Risk analysis and risk management

The Security Rule expects a documented risk analysis of every system that creates, receives, maintains or transmits ePHI, followed by risk management measures. The gateway is one system in that analysis, and it adds new data stores such as the spend log database, Redis and any Presidio containers. Confirm that the analysis names each of these components, the threats to prompt content, and who reviews the results when the gateway configuration changes.

Subpart C text

Workforce security training

Training on how to send prompts, which data may enter them, and how to handle a masked or blocked response is the responsibility of your workforce program, not the gateway. Users who paste full patient charts into a chat client will bypass masking settings that only act on data passing through the proxy. Confirm that training covers approved use cases, the prohibition on pasting unredacted records into unapproved tools, and how completion is recorded.

Contingency and backup planning

A gateway outage can stop clinical or administrative workflows that depend on it, and its PostgreSQL database holds keys, budgets and logs. The Security Rule requires data backup, disaster recovery and emergency mode operation plans for ePHI systems. Confirm that backups of the database and configuration are encrypted, that restores have been tested, and that a documented fallback exists when the gateway is unavailable.

Physical safeguards of hosting facilities

Physical controls over the servers, data center or cloud facilities that run the gateway, its database and its log storage sit outside LiteLLM. Facility access, workstation use and device and media disposal are physical standards under 164.310. Confirm with your hosting provider which facility controls they operate, which they attest to, and which you must document yourself, including disposal of disks that once held prompt or log data.

Business associate agreements with providers

Any model provider, hosting vendor or subcontractor that receives or stores ePHI needs a business associate contract that meets 45 CFR 164.314(a)(2)(i). The gateway can route prompts to a provider, but it cannot establish that the provider has signed one. Confirm which providers are covered by a signed agreement, that the agreement flows the same terms to their subcontractors, and that incident reporting timelines are written into it before routing any PHI there.

Section 164.314 text

No HIPAA certification exists

No product, gateway or vendor can certify HIPAA compliance, and HHS does not recognize private certifications as proof of it. A LiteLLM deployment with logging and masking enabled is a set of controls you can evidence, not a certificate you can display. Confirm that your compliance records describe the controls you operate, the evidence you hold for each, and how an assessor or HHS complaint review would test them.

Configuration sequence for a HIPAA-scoped LiteLLM gateway

This sequence takes a self-hosted LiteLLM gateway from scope decision to documented configuration, so that prompts carrying ePHI stay out of default logs, access is controlled per person and key, and the covered entity holds evidence for its Security Rule decisions.

  1. Decide scope and classify prompt data

    The covered entity or business associate decides whether the gateway creates, receives, maintains or transmits ePHI, and which applications, teams and models will send it. Compliance and engineering list the data types each route may carry, such as clinical notes, billing text or scheduling messages, and mark routes that must never receive PHI. Done when the scope statement names every route in scope and every route excluded, and the compliance owner has signed it. Confirm with counsel whether any business associate contract under 45 CFR 164.314(a)(2)(i) is needed with the hosting or support provider.

  2. Keep prompt storage in spend logs disabled

    Confirm that store_prompts_in_spend_logs is not set in the proxy configuration. LiteLLM does not store request and response content in its logs by default, and storing prompts requires an explicit opt-in, so this step is a verification rather than a change for most deployments. Review the configuration file and environment variables in version control, then send a test request containing a synthetic identifier and check the spend log table and admin UI logs to confirm the text is absent. Record the test result and the configuration commit as evidence.

  3. Deploy Presidio and test masking on sample PHI

    Deploy the Presidio Analyzer and Anonymizer containers separately from the gateway, in a non-production environment first. Configure the Presidio guardrail for the modes your design needs, such as pre_call for masking before the provider receives text and logging_only for masking what is written to logs. Send a set of synthetic records that contain names, dates of birth, medical record numbers, phone numbers and addresses, and compare the provider-bound payload and the log output against expected results. Done when every planted identifier in the test set is masked or blocked in each mode you enable, and the failures are documented with the remaining gaps.

  4. Enforce SSO and virtual keys with budgets

    Connect the admin UI to your identity provider using SSO, and issue virtual keys to named users, teams or service accounts rather than sharing one credential. Set per-key budgets, TPM and RPM limits, and restrict each key to the models its use case needs. Confirm the SSO edition requirement for your user count against the current LiteLLM licensing documentation before rollout, because the free SSO allowance is limited. Verify that a disabled user cannot create or use keys, and that a key restricted to one model is rejected for another. Keep the test results with the access design.

  5. Store the master key in a secret manager

    Generate LITELLM_MASTER_KEY, which must start with sk-, and place it in a secret manager your organization controls rather than in a plain configuration file or container image. Limit read access to the deployment identity and the small group that administers the gateway, and inject the value at runtime. Confirm that the key does not appear in logs, shell history or CI output. Rotation procedure and owner should be written down before go-live. Done when a search of the repository, images and logs finds no copy of the key.

  6. Set log retention and export to your own store

    Decide how long gateway audit and request logs are kept, and set the retention period in the storage system that holds them, not only in the gateway. Export logs to a store your organization controls, such as a SIEM or log platform in your infrastructure, and confirm that key creation, budget changes and model changes are captured in audit records. Under 45 CFR 164.312(b), the covered entity must have mechanisms that record and examine activity in systems that use ePHI, so review who examines these logs and how often. Done when a test administrative change appears in the exported store with the actor and timestamp.

  7. Document addressable specification decisions

    For each addressable implementation specification that applies to the gateway, such as automatic logoff, encryption and emergency access, record whether it is reasonable and appropriate, the reasoning if it is not adopted, and the equivalent alternative measure. Under 45 CFR 164.306(d), this assessment is required for addressable specifications. Map the decisions to the relevant standards in 45 CFR 164.312 and 164.308, and keep the document with other Security Rule documentation for at least 6 years from creation or from the date last in effect, whichever is later (45 CFR 164.316(b)(2)(i)). Done when every addressable specification in scope has a recorded decision and an owner who has reviewed it.

Questions buyers ask before hiring help with HIPAA and LiteLLM

Does running LiteLLM make our organization HIPAA compliant?

No. LiteLLM is software, and HIPAA compliance is a property of how your organization runs its people, policies, systems and business associate relationships. LiteLLM supplies controls you can configure, such as keeping prompt bodies out of spend logs by default, virtual keys, SSO on the Enterprise tier and audit records of key and model changes. Those controls support your Security Rule program but do not replace it. There is also no HIPAA certification to obtain: HHS states that no Security Rule standard requires certifying compliance and that private certifications do not prevent a later finding of violation. Your covered entity or business associate status, risk analysis and documentation remain your responsibility.

What drives the effort and cost of a HIPAA-oriented LiteLLM build?

Scope is the main driver. The effort rises with the volume and variety of prompts that may carry ePHI, the number of model providers and private models behind the gateway, the identity tier you need, how many masking test cases you must run, and how much documentation your compliance team expects. Each item adds configuration, testing and written evidence. Fixed-scope work is priced from a written scope, so ask for each of these items to be listed separately in the quote. DeployOpen does not publish a price list, and any figure should come from that scope rather than from a general rate.

Can our internal team set this up without a partner?

Often yes, if you already run PostgreSQL, Kubernetes or your cloud platform and have engineers who can test masking and logging behavior. The harder parts are usually not the install. They are proving that prompt content stays out of logs at every setting you use, testing Presidio masking against realistic clinical text, writing the audit and retention procedures, and keeping the configuration under change control. Ask yourself whether you have people with time to do the testing and documentation, and whether someone will own the gateway after go-live. A partner can take on any part of that work under a written scope.

How long does the work take, and what do we need to provide?

The duration depends on the scope agreed in writing, so no fixed timeline should be assumed before that scope exists. Plan for named owners in security, compliance, platform engineering and the clinical or business team that sends prompts. Provide access to the cloud account or cluster where the gateway will run, the current data flow diagram if one exists, the list of model providers and their contracts, and sample prompts that resemble real workflows for masking tests. Use synthetic or de-identified examples where possible, and confirm with your privacy officer what may be copied into a test environment.

Does LiteLLM SSO require the Enterprise license beyond five users?

Yes, according to the LiteLLM documentation supplied for this page. From v1.76.0, SSO for the admin UI with Google, Microsoft Entra ID, Okta and generic OIDC providers is free for up to 5 users, and an Enterprise license is needed beyond that. Enterprise also adds SCIM, JWT authentication with identity provider tokens, audit logs, organization and team RBAC and IP allowlisting. Confirm the current terms with LiteLLM before you commit, because the license and feature split can change between releases.

What does a business associate agreement with a model provider need to cover?

Under 45 CFR 164.314(a)(2)(i), a business associate contract must require the business associate to comply with the Security Rule, flow the same terms down to subcontractors that handle ePHI, and report security incidents, including breaches of unsecured PHI, to the covered entity. Before sending PHI to any model provider, ask whether that provider will sign a business associate agreement and whether its services are covered by it. Do not assume that a self-hosted gateway removes the need for this, because prompts still leave your environment when they reach a provider. Your legal or privacy team should review the agreement, and DeployOpen does not provide legal advice.

Which HIPAA duties stay with us when we run the gateway ourselves?

The covered entity or business associate keeps the duties that depend on its own people, policies and decisions. These include the risk analysis, workforce access decisions, the choice of which prompts may carry ePHI, incident response, business associate contracts and retention of Security Rule documentation for 6 years from creation or from the date it was last in effect, whichever is later (45 CFR 164.316(b)(2)(i)). LiteLLM can record activity that supports the audit controls in 45 CFR 164.312(b), but you decide what to review and how often. NIST SP 800-66 Rev. 2 is a useful informational guide for mapping these duties.

How DeployOpen works on this

DeployOpen plans and deploys self-hosted LiteLLM inside your own infrastructure, with the prompt logging, masking, retention and key controls set before any real PHI reaches the gateway. We document which HIPAA Security Rule duties the gateway supports and which stay with your organization and its business associates, so your compliance and security teams can review the setup.

How we scope

  • Written scope lists the model providers, private models, identity provider and log destinations that handle prompts containing ePHI.
  • We confirm whether prompt bodies stay out of spend logs and document each setting that controls storage, masking and retention.
  • Scope states which HIPAA Security Rule duties the gateway supports and which remain with your covered entity or business associates.

How we build

  • We deploy PostgreSQL and Redis, the proxy, and Presidio Analyzer and Anonymizer containers in the environment you control.
  • We configure virtual keys, team budgets, model restrictions and SSO, and test that key and model changes produce audit records.
  • We test masking in pre_call and logging_only modes against sample PHI-like test data and confirm that raw prompts do not appear in logs.

How we hand over

  • Deliverables include configuration as code, a data-flow description and a log and retention register for compliance reviewers.
  • Documentation maps each control to the relevant Security Rule standard or implementation specification, in our own words, for your review.
  • Handover covers an operations runbook, the retention periods you approved and a list of items your organization must confirm.

How we support

  • Fixed-scope engagements have written deliverables and timelines agreed before work starts.
  • Ongoing upgrades, monitoring of supported release lines and continuous testing are available as a retainer.
  • Retainer support can include retesting after configuration changes and help preparing evidence for your own assessments.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.